Skip to content

Commit

Permalink
Merge branch 'master' into cleanup/deduplicate-blockdownloader-code
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams authored Feb 11, 2025
2 parents ed41195 + 1b6f450 commit b688fd6
Show file tree
Hide file tree
Showing 84 changed files with 1,718 additions and 794 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Nethermind documentation is available at [docs.nethermind.io](https://docs.nethe

### Supported networks

**Ethereum** · **Gnosis** · **Optimism** · **Base** · **Taiko** · **Linea** · **Energy Web**
**Ethereum** · **Gnosis** · **Optimism** · **Base** · **Taiko** · **World Chain** · **Linea** · **Energy Web**

## Installing

Expand Down Expand Up @@ -88,7 +88,7 @@ This is the easiest and fastest way to build Nethermind if you don't want to clo
docker build https://github.com/nethermindeth/nethermind.git -t nethermind
```

For more info, see [Bulding Docker image](https://docs.nethermind.io/developers/building-from-source#bulding-docker-image).
For more info, see [Building Docker image](https://docs.nethermind.io/developers/building-from-source#bulding-docker-image).

### Standalone binaries

Expand Down Expand Up @@ -125,12 +125,12 @@ For more info, see [Building standalone binaries](https://docs.nethermind.io/dev

## Contributing

BEFORE you start work on a feature or fix, please read and follow our [contributing guidelines](./CONTRIBUTING.md) to help avoid any wasted or duplicate effort.
Before you start working on a feature or fix, please read and follow our [contributing guidelines](./CONTRIBUTING.md) to help avoid any wasted or duplicate effort.

## Security

If you believe you have found a security vulnerability in our code, please report it to us as described in our [security policy](SECURITY.md).

## License

Nethermind is an open-source software licensed under the [LGPL-3.0](./LICENSE-LGPL).
Nethermind is an open-source software licensed under the [LGPL-3.0](./LICENSE-LGPL). By using this project, you agree to abide by the license and [additional terms](https://nethermindeth.github.io/NethermindEthereumClientTermsandConditions/).
90 changes: 53 additions & 37 deletions scripts/syncSettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,113 +22,129 @@
"mainnet": {
"url": "api.etherscan.io",
"blockReduced": 1000,
"multiplierRequirement": 1000
"multiplierRequirement": 1000,
"isPoS": True
},
"gnosis": {
"url": "https://rpc.gnosischain.com",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"chiado": {
"url": "https://rpc.chiadochain.net",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"sepolia": {
"url": "api-sepolia.etherscan.io",
"blockReduced": 1000,
"multiplierRequirement": 1000
"multiplierRequirement": 1000,
"isPoS": True
},
"energyweb": {
"url": "https://rpc.energyweb.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
},
"volta": {
"url": "https://volta-rpc.energyweb.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
},
"exosama": {
"url": "https://rpc.exosama.com",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
},
"joc-mainnet": {
"url": "https://rpc-1.japanopenchain.org:8545",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
},
"joc-testnet": {
"url": "https://rpc-1.testnet.japanopenchain.org:8545",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
},
"base-mainnet": {
"url": "https://mainnet.base.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"base-sepolia": {
"url": "https://sepolia.base.org",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"op-mainnet": {
"url": "https://mainnet.optimism.io",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"op-sepolia": {
"url": "https://sepolia.optimism.io",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": True
},
"linea-mainnet": {
"url": "https://rpc.linea.build",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
},
"linea-sepolia": {
"url": "https://rpc.sepolia.linea.build",
"blockReduced": 8192,
"multiplierRequirement": 10000
"multiplierRequirement": 10000,
"isPoS": False
}
}

def fastBlocksSettings(configuration, apiUrl, blockReduced, multiplierRequirement):
def fastBlocksSettings(configuration, apiUrl, blockReduced, multiplierRequirement, isPoS):
if "etherscan" in apiUrl:
latestBlock = int(json.loads(subprocess.getoutput(f'curl --silent "https://{apiUrl}/api?module=proxy&action=eth_blockNumber&apikey={key}"'))['result'],16)
latestBlock = int(json.loads(subprocess.getoutput(
f'curl --silent "https://{apiUrl}/api?module=proxy&action=eth_blockNumber&apikey={key}"'))['result'], 16)
else:
data = '{"id":0,"jsonrpc":"2.0","method": "eth_blockNumber","params": []}'

response = requests.post(apiUrl, headers=headers, data=data).text
data_req = '{"id":0,"jsonrpc":"2.0","method": "eth_blockNumber","params": []}'
response = requests.post(apiUrl, headers=headers, data=data_req).text
latestBlock = int(json.loads(response)['result'], 16)

baseBlock = latestBlock - blockReduced
baseBlock = baseBlock - baseBlock % multiplierRequirement

if "etherscan" in apiUrl:
pivot = json.loads(subprocess.getoutput(f'curl --silent "https://{apiUrl}/api?module=proxy&action=eth_getBlockByNumber&tag={hex(baseBlock)}&boolean=true&apikey={key}"'))
pivot = json.loads(subprocess.getoutput(
f'curl --silent "https://{apiUrl}/api?module=proxy&action=eth_getBlockByNumber&tag={hex(baseBlock)}&boolean=true&apikey={key}"'))
else:
data = '{"id":0,"jsonrpc":"2.0","method": "eth_getBlockByNumber","params": ["' +str(hex(baseBlock))+ '", false]}'
pivot = json.loads(requests.post(apiUrl, headers=headers, data=data).text)
data_req = '{"id":0,"jsonrpc":"2.0","method": "eth_getBlockByNumber","params": ["' + str(hex(baseBlock)) + '", false]}'
pivot = json.loads(requests.post(apiUrl, headers=headers, data=data_req).text)

pivotHash = pivot['result']['hash']
pivotTotalDifficulty = int(pivot['result'].get('totalDifficulty', '0x0'), 16)
print(configuration + 'LatestBlock: ' + str(latestBlock))
print(configuration + 'PivotNumber: ' + str(baseBlock))
print(configuration + 'PivotHash: ' + str(pivotHash))
print(configuration + 'PivotTotalDifficulty: ' + str(pivotTotalDifficulty))
data = {}

print(configuration + ' LatestBlock: ' + str(latestBlock))
print(configuration + ' PivotNumber: ' + str(baseBlock))
print(configuration + ' PivotHash: ' + str(pivotHash))
if not isPoS:
print(configuration + ' PivotTotalDifficulty: ' + str(pivotTotalDifficulty))

with open(f'{configsPath}/{configuration}.json', 'r') as mainnetCfg:
data = json.load(mainnetCfg)
data['Sync']['PivotNumber'] = baseBlock
data['Sync']['PivotHash'] = pivotHash

data['Sync']['PivotNumber'] = baseBlock
data['Sync']['PivotHash'] = pivotHash

if not isPoS:
data['Sync']['PivotTotalDifficulty'] = str(pivotTotalDifficulty)
with open(f'{configsPath}/{configuration}.json', 'w') as mainnetCfgChanged:
json.dump(data, mainnetCfgChanged, indent=2)

with open(f'{configsPath}/{configuration}.json', 'w') as mainnetCfgChanged:
json.dump(data, mainnetCfgChanged, indent=2)

for config, value in configs.items():
print(emoji.emojize(f"{config.capitalize()} section :white_check_mark: "))
fastBlocksSettings(config, value['url'], value['blockReduced'], value['multiplierRequirement'])
fastBlocksSettings(config, value['url'], value['blockReduced'], value['multiplierRequirement'], value['isPoS'])
16 changes: 16 additions & 0 deletions scripts/workflow_config/sync_testnets_matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,5 +118,21 @@
"checkpoint-sync-url": "",
"timeout": 180,
"agent": "g6-standard-6"
},
{
"network": "energyweb",
"cl": "",
"cl_image": "",
"checkpoint-sync-url": "",
"timeout": 180,
"agent": "g6-standard-6"
},
{
"network": "volta",
"cl": "",
"cl_image": "",
"checkpoint-sync-url": "",
"timeout": 180,
"agent": "g6-standard-6"
}
]
10 changes: 8 additions & 2 deletions src/Nethermind/Chains/energyweb.json
Original file line number Diff line number Diff line change
Expand Up @@ -233,11 +233,17 @@
}
},
"nodes": [
"enode://6c2f5c236b88a1eba30a26f2114ec9b8c4d741495e21f9d59c1f7d2a19ba20fda52ed1e319d935f95441f9f3b944423ce8d032fa3019691df217129964680591@ewc-bootnode-01.energyweb.org:30303",
"enode://cc67008e850c4b64702f1664f18704dd23980fb574138588904270739dca3a9c417ac3f97077b0f4e4872a5db109195f7137c156314dbcc724eabd809044553e@ewc-bootnode-02.energyweb.org:30303",
"enode://34f97743b9c07fac84c2db921337f006b5932e14c29df496951bdcfe3fce71e3d1504c25d66156dae01065623849b4fe940168c7e3f21c49b538af0cabb5805f@ewc-bootnode-03.energyweb.org:30303",
"enode://41ff9e64e1277f4f1168894d77bcbfd810a184929e3e40a1f0cfc91802bff014cc920653ce1da79fd237c8ae719fd1b58524f9664ac6319fe57ebb63b2b9728d@ewc-bootnode-03.energyweb.org:30303",
"enode://d97233ccebecaa15e07c46fca34d355fd978ffb2b9194b2486e6978aa3dd74a638db0c80fe27e6258929000996c37aa92c70a73720bf480a479dd8ec15ba0535@ewc-bootnode-04.energyweb.org:30303",
"enode://80e49825bb6bdfbf69576fd4a5f7bb173db98c08439bd7a019e2d42548afbb1f70232b74ede42dbd99cc0de3990a0101d49543c1b299027d2fd6f5a2c81eff75@ewc-bootnode-05.energyweb.org:30303",
"enode://1cd00f54ddaa41793d32500f0cb123d43e95f5ed18220c367d5a4db7d111e5fb59f250c397e40977562881875827f022d88a51e51171daaebf916beaa60e2139@ewc-bootnode-06.energyweb.org:30303",
"enode://acd6673ac09eee760b7cce6a7e1cd1559294afd43c353b796cc5251cff04d8950c92f53fc3d8d727c97d1e1a0356ae16ec2447c06842ba6c2ff9f9fa0eb13629@ewc-bootnode-07.energyweb.org:30303",
"enode://d094aac598a05fc8d8347e009e1e9efaceb83dbb64c89e845f7181b53b6e9146e34caafaf658f66cfad1758c58908c560bde3bc873c18eb9d32150d4c89803c2@ewc-bootnode-08.energyweb.org:30303",
"enode://3a8588bd883ea3bce606b08e7ca71d55717077cb3d25d3c00421ac371fbae286b94f58ba2e739b17b64c4d0d3e19f1b0ae2e47962703b42d7f36f1b9a448d4ea@ewc-bootnode-09.energyweb.org:30303",
"enode://69749dbe7e6f5fceaeb0a16f60353b3ec04825a12400e6d581fe980275e96fecb464276e61d79fc1628e448f1f74da2985d778ea54e0e8e7c64d980f2b3b6a94@ewc-bootnode-10.energyweb.org:30303"
"enode://69749dbe7e6f5fceaeb0a16f60353b3ec04825a12400e6d581fe980275e96fecb464276e61d79fc1628e448f1f74da2985d778ea54e0e8e7c64d980f2b3b6a94@ewc-bootnode-10.energyweb.org:30303",
"enode://36c86675b4cf3b3ad9913a16b22acbec28c03aaba9fafeb97b6a293dbe9ccbe9ab9895663adb47387003258c8308344c1183c3f247a0812a1f3f53c9575bc582@ewc-bootnode-11.energyweb.org:30303",
"enode://b433e5eef569ee9f690a82d7aecc79769da7dd029c22229623253fbc55da4fd5a4b1352d3f46eb67044e100ca59d9ee667f36811041a6068dfbb625b5b34b4de@ewc-bootnode-12.energyweb.org:30303"
]
}
Loading

0 comments on commit b688fd6

Please sign in to comment.