Skip to content

Commit

Permalink
Merge from main
Browse files Browse the repository at this point in the history
  • Loading branch information
tonykwok1992 committed Jun 14, 2024
2 parents 2990a5a + cf833ba commit 4a39b11
Show file tree
Hide file tree
Showing 12 changed files with 322 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline

### Features

* bump snapshot version to 4.12.1 [#2058](https://github.com/web3j/web3j/pull/2058)
* bump snapshot version to 4.12.1 [#2058](https://github.com/hyperledger/web3j/pull/2058)
* Update maintainer requirements status [#2064](https://github.com/hyperledger/web3j/pull/2064)

### BREAKING CHANGES

Expand Down
108 changes: 98 additions & 10 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
Maintainers
===========
<!-- Please keep all lists sorted alphabetically by github -->

**Active Maintainers**

| Name | GitHub | Chat |
|----------------|--------|-----|
| Conor Svensson | [conor10][conor10] | conor10 |
| Andrii | [andrii-kl][andrii-kl] | andrii-kl |
| George Ţebrean | [gtebrean][gtebrean] | gdev#2230 |
| Nischal Sharma | [NickSneo][NickSneo] | nicks1106 |

<!-- web3j-maintainers group has maintainer access to web3j repo -->

| Name | Github | LFID |
|----------------|------------------------|-----------|
| Andrii Kliui | [andrii-kl][andrii-kl] | andrii.k |
| Conor Svensson | [conor10][conor10] | conor |
| George Ţebrean | [gtebrean][gtebrean] | gtebrean |
| Nischal Sharma | [NickSneo][NickSneo] | nicks1106 |

[conor10]: https://github.com/conor10
[gtebrean]: https://github.com/gtebrean
Expand All @@ -21,8 +22,95 @@ Maintainers

**Emeritus Maintainers**

| Name | GitHub | Chat |
|------|------------------|------|
|Christian Felde | [cfelde][cfelde] | cfelde |
| Name | Github | LFID |
|-----------------|---------------------|---------|
| Christian Felde | [cfelde][cfelde] | cfelde |

[cfelde]: https://github.com/cfelde

## Becoming a Maintainer

Web3J welcomes community contribution.
Each community member may progress to become a maintainer.

How to become a maintainer:

- Contribute significantly to the code in web3j repositories.

### Maintainers contribution requirement

The requirement to be able to be proposed as a maintainer is:

- 5 significant changes on code have been authored in this repos by the proposed maintainer and accepted (merged PRs).

### Maintainers approval process

The following steps must occur for a contributor to be "upgraded" as a maintainer:

- The proposed maintainer has the sponsorship of at least one other maintainer.
- This sponsoring maintainer will create a proposal PR modifying the list of
maintainers. (see [proposal PR template](#proposal-pr-template).)
- The proposed maintainer accepts the nomination and expresses a willingness
to be a long-term (more than 6 month) committer by adding a comment in the proposal PR.
- The PR will be communicated in all appropriate communication channels
including at least [web3j-contributors channel on Hyperledger Discord](https://discord.gg/hyperledger),
the [mailing list](https://lists.hyperledger.org/g/web3j)
and any maintainer/community call.
- Approval by at least 2 current maintainers within two weeks of the proposal or
an absolute majority (half the total + 1) of current maintainers.
- Maintainers will vote by approving the proposal PR.
- No veto raised by another maintainer within the voting timeframe.
- All vetoes must be accompanied by a public explanation as a comment in the
proposal PR.
- A veto can be retracted, in that case the voting timeframe is reset and all approvals are removed.
- It is bad form to veto, retract, and veto again.

The proposed maintainer becomes a maintainer either:

- when two weeks have passed without veto since the third approval of the proposal PR,
- or an absolute majority of maintainers approved the proposal PR.

In either case, no maintainer raised and stood by a veto.

## Removing Maintainers

Being a maintainer is not a status symbol or a title to be maintained indefinitely.

It will occasionally be necessary and appropriate to move a maintainer to emeritus status.

This can occur in the following situations:

- Resignation of a maintainer.
- Violation of the Code of Conduct warranting removal.
- Inactivity.
- A general measure of inactivity will be no commits or code review comments
for two reporting quarters, although this will not be strictly enforced if
the maintainer expresses a reasonable intent to continue contributing.
- Reasonable exceptions to inactivity will be granted for known long term
leave such as parental leave and medical leave.
- Other unspecified circumstances.

As for adding a maintainer, the record and governance process for moving a
maintainer to emeritus status is recorded using review approval in the PR making that change.

Returning to active status from emeritus status uses the same steps as adding a
new maintainer.

Note that the emeritus maintainer always already has the required significant contributions.
There is no contribution prescription delay.

## Proposal PR template

```markdown
I propose to add [maintainer github handle] as a Web3J project maintainer.

[maintainer github handle] contributed with many high quality commits:

- [list significant achievements]

Here are [their past contributions on Web3J project](https://github.com/hyperledger/web3j/commits?author=[user github handle]).

Voting ends two weeks from today.

For more information on this process see the Becoming a Maintainer section in the MAINTAINERS.md file.
```
Original file line number Diff line number Diff line change
Expand Up @@ -457,24 +457,29 @@ private List<TypeSpec> buildStructTypes(final List<AbiDefinition> functionDefini
final List<AbiDefinition.NamedType> orderedKeys = extractStructs(functionDefinitions);
int structCounter = 0;
final List<TypeSpec> structs = new ArrayList<>();
final Map<String, Integer> structNamesCountPreview = new HashMap<>();

for (final AbiDefinition.NamedType namedType : orderedKeys) {
final String internalType = namedType.getInternalType();
if (internalType != null && !internalType.isEmpty()) {
final String structName = getStructName(internalType);
structNamesCountPreview.putIfAbsent(structName, 0);
structNamesCountPreview.compute(structName, (s, count) -> count + 1);
}
}

for (final AbiDefinition.NamedType namedType : orderedKeys) {
final String internalType = namedType.getInternalType();
final String structName;
if (internalType == null || internalType.isEmpty()) {
structName = "Struct" + structCounter;
} else {
final String fullStructName =
internalType.substring(internalType.lastIndexOf(" ") + 1);
String tempStructName =
fullStructName.substring(fullStructName.lastIndexOf(".") + 1);
int arrayPos = tempStructName.indexOf("[");
if (arrayPos > -1) {
tempStructName = tempStructName.substring(0, arrayPos);
String tempStructName = getStructName(internalType);
if (structNamesCountPreview.getOrDefault(tempStructName, 0) > 1) {
structName = getStructName(internalType.replace(".", "_"));
} else {
structName = tempStructName;
}
structName =
SourceVersion.isName(tempStructName)
? tempStructName
: "_" + tempStructName;
}

final TypeSpec.Builder builder =
Expand Down Expand Up @@ -578,6 +583,19 @@ private List<TypeSpec> buildStructTypes(final List<AbiDefinition> functionDefini
return structs;
}

@NotNull
private static String getStructName(String internalType) {
final String fullStructName = internalType.substring(internalType.lastIndexOf(" ") + 1);
String tempStructName = fullStructName.substring(fullStructName.lastIndexOf(".") + 1);
int arrayPos = tempStructName.indexOf("[");
if (arrayPos > -1) {
tempStructName = tempStructName.substring(0, arrayPos);
}
final String structName =
SourceVersion.isName(tempStructName) ? tempStructName : "_" + tempStructName;
return structName;
}

private String adjustToNativeTypeIfNecessary(NamedType component) {
if (useNativeJavaTypes && structClassNameMap.get(component.structIdentifier()) == null) {
if (ARRAY_SUFFIX.matcher(component.getType()).find()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ public void testDeployMethodGenerated() throws Exception {
compareJavaFile("MetaCoin", true);
}

@Test
public void testSameInnerStructName() throws Exception {
testCodeGeneration("sameinnerstructname", "SameInnerStructName", JAVA_TYPES_ARG, false);
testCodeGeneration("sameinnerstructname", "SameInnerStructName", SOLIDITY_TYPES_ARG, false);
}

@Test
public void testSameInnerStructNameCompareJavaFile() throws Exception {
compareJavaFile("SameInnerStructName", true);
}

@Test
public void testArrayOfStructClassGeneration() throws Exception {
testCodeGeneration(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.20;

library Foo {
struct Info {
bool dummy;
}
}

library Bar {
struct Info {
bool dummy;
}
}
contract SameInnerStructName {

constructor() {

}
function test(Foo.Info calldata foo, Bar.Info calldata bar) external {
revert();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122084a12bad14446abd271fd63e8490580f720401bd246b20d3c4c44a014f9b353064736f6c63430008140033
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6055604b600b8282823980515f1a607314603f577f4e487b71000000000000000000000000000000000000000000000000000000005f525f60045260245ffd5b305f52607381538281f3fe730000000000000000000000000000000000000000301460806040525f80fdfea264697066735822122050486bc1933b68f15a8374411ab7b0405b4f544c21aa8c14252f303a3b358ce464736f6c63430008140033
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"components":[{"internalType":"bool","name":"dummy","type":"bool"}],"internalType":"struct Foo.Info","name":"foo","type":"tuple"},{"components":[{"internalType":"bool","name":"dummy","type":"bool"}],"internalType":"struct Bar.Info","name":"bar","type":"tuple"}],"name":"test","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
608060405234801561000f575f80fd5b5060f18061001c5f395ff3fe6080604052348015600e575f80fd5b50600436106026575f3560e01c8063b1a29dbb14602a575b5f80fd5b60406004803603810190603c91906084565b6042565b005b5f80fd5b5f80fd5b5f80fd5b5f60208284031215606057605f604a565b5b81905092915050565b5f60208284031215607b57607a604a565b5b81905092915050565b5f806040838503121560975760966046565b5b5f60a285828601604e565b925050602060b1858286016069565b915050925092905056fea2646970667358221220024a769b6d57f11f6f5df0145ce9d31d8dd2ec08b9a923116f016e14a0912bb464736f6c63430008140033
Loading

0 comments on commit 4a39b11

Please sign in to comment.