Skip to content

Commit

Permalink
chore: fix ci issues (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing authored May 30, 2024
1 parent b636310 commit b0189bd
Show file tree
Hide file tree
Showing 32 changed files with 139 additions and 134 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
merge_group:
push:
branches: [main]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,7 +19,7 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }}
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
strategy:
Expand Down Expand Up @@ -56,7 +56,7 @@ jobs:
name: sync / 100k blocks
# Only run sync tests in merge groups
if: github.event_name == 'merge_group'
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
name: integration success
runs-on: ubuntu-latest
if: always()
needs: [test]
needs: [ test ]
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
pull_request:
merge_group:
push:
branches: [main]
branches: [ main ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -19,13 +19,13 @@ concurrency:
jobs:
test:
name: test / ${{ matrix.network }} (${{ matrix.partition }}/2)
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
strategy:
matrix:
partition: [1, 2]
network: [ethereum, optimism]
partition: [ 1, 2 ]
network: [ ethereum, optimism ]
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:
state:
name: Ethereum state tests
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_LOG: info,sync=error
RUST_BACKTRACE: 1
Expand All @@ -77,7 +77,7 @@ jobs:

doc:
name: doc tests (${{ matrix.network }})
runs-on: ubuntu-latest
runs-on: [ bnb-chain-ap-qa-cicd-runners ]
env:
RUST_BACKTRACE: 1
timeout-minutes: 30
Expand All @@ -101,7 +101,7 @@ jobs:
name: unit success
runs-on: ubuntu-latest
if: always()
needs: [test, state, doc]
needs: [ test, state, doc ]
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
8 changes: 4 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ rust.missing_debug_implementations = "warn"
rust.missing_docs = "warn"
rust.unreachable_pub = "warn"
rust.unused_must_use = "deny"
rust.rust_2018_idioms = "deny"
rust.rust_2018_idioms = { level = "deny", priority = -1 }
rustdoc.all = "warn"

[workspace.lints.clippy]
Expand Down Expand Up @@ -401,6 +401,6 @@ similar-asserts = "1.5.0"
test-fuzz = "5"

[patch.crates-io]
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "f5cc71d" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "f5cc71d" }
revm = { git = "https://github.com/bnb-chain/revm.git", rev = "4be2578" }
revm-primitives = { git = "https://github.com/bnb-chain/revm.git", rev = "4be2578" }
alloy-chains = { git = "https://github.com/alloy-rs/chains.git", rev = "906d6fb" }
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -414,9 +414,9 @@ fix-lint-other-targets:
-- -D warnings

fix-lint:
make lint-reth && \
make lint-op-reth && \
make lint-other-targets && \
make fix-lint-reth && \
make fix-lint-op-reth && \
make fix-lint-other-targets && \
make fmt

.PHONY: rustdocs
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/db/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ impl Command {
let max_widths = table.column_max_content_widths();
let mut separator = Row::new();
for width in max_widths {
separator.add_cell(Cell::new(&"-".repeat(width as usize)));
separator.add_cell(Cell::new("-".repeat(width as usize)));
}
table.add_row(separator);

Expand Down
7 changes: 6 additions & 1 deletion crates/blockchain-tree/src/blockchain_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,12 @@ where
// get parent hashes
let mut parent_block_hashes = self.all_chain_hashes(chain_id);
let first_pending_block_number =
*parent_block_hashes.first_key_value().expect("There is at least one block hash").0;
if let Some(key_value) = parent_block_hashes.first_key_value() {
*key_value.0
} else {
debug!(target: "blockchain_tree", ?chain_id, "No blockhashes stored");
return None
};
let canonical_chain = canonical_chain
.iter()
.filter(|&(key, _)| key < first_pending_block_number)
Expand Down
8 changes: 4 additions & 4 deletions crates/consensus/beacon/src/engine/hooks/prune.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ impl<DB: Database + 'static> PruneHook<DB> {

/// This will try to spawn the pruner if it is idle:
/// 1. Check if pruning is needed through [Pruner::is_pruning_needed].
/// 2.
/// 1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
/// separate task. Set pruner state to [PrunerState::Running].
/// 2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
///
/// 2.1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
/// separate task. Set pruner state to [PrunerState::Running].
/// 2.2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
///
/// If pruner is already running, do nothing.
fn try_spawn_pruner(&mut self, tip_block_number: BlockNumber) -> Option<EngineHookEvent> {
Expand Down
14 changes: 7 additions & 7 deletions crates/consensus/beacon/src/engine/hooks/static_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ impl<DB: Database + 'static> StaticFileHook<DB> {
/// 1. Check if producing static files is needed through
/// [StaticFileProducer::get_static_file_targets](reth_static_file::StaticFileProducerInner::get_static_file_targets)
/// and then [StaticFileTargets::any](reth_static_file::StaticFileTargets::any).
/// 2.
/// 1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and spawn
/// it in a separate task. Set static file producer state to
/// [StaticFileProducerState::Running].
/// 2. If producing static files is not needed, set static file producer state back to
/// [StaticFileProducerState::Idle].
///
/// 2.1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and
/// spawn it in a separate task. Set static file producer state to
/// [StaticFileProducerState::Running].
/// 2.2. If producing static files is not needed, set static file producer state back to
/// [StaticFileProducerState::Idle].
///
/// If static_file_producer is already running, do nothing.
fn try_spawn_static_file_producer(
Expand Down
10 changes: 5 additions & 5 deletions crates/consensus/beacon/src/engine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -710,13 +710,13 @@ where
/// If validation fails, the response MUST contain the latest valid hash:
///
/// - The block hash of the ancestor of the invalid payload satisfying the following two
/// conditions:
/// conditions:
/// - It is fully validated and deemed VALID
/// - Any other ancestor of the invalid payload with a higher blockNumber is INVALID
/// - 0x0000000000000000000000000000000000000000000000000000000000000000 if the above
/// conditions are satisfied by a PoW block.
/// conditions are satisfied by a PoW block.
/// - null if client software cannot determine the ancestor of the invalid payload satisfying
/// the above conditions.
/// the above conditions.
fn latest_valid_hash_for_invalid_payload(
&mut self,
parent_hash: B256,
Expand Down Expand Up @@ -1110,8 +1110,8 @@ where
/// - invalid extra data
/// - invalid transactions
/// - incorrect hash
/// - the versioned hashes passed with the payload do not exactly match transaction
/// versioned hashes
/// - the versioned hashes passed with the payload do not exactly match transaction versioned
/// hashes
/// - the block does not contain blob transactions if it is pre-cancun
///
/// This validates the following engine API rule:
Expand Down
2 changes: 1 addition & 1 deletion crates/exex/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ pub struct ExExManagerMetrics {
/// The manager is responsible for:
///
/// - Receiving relevant events from the rest of the node, and sending these to the execution
/// extensions
/// extensions
/// - Backpressure
/// - Error handling
/// - Monitoring
Expand Down
1 change: 1 addition & 0 deletions crates/interfaces/src/blockchain_tree/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ pub enum BlockStatus {
/// This is required to:
/// - differentiate whether trie state updates should be cached.
/// - inform other
///
/// This is required because the state root check can only be performed if the targeted block can be
/// traced back to the canonical __head__.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
Expand Down
4 changes: 2 additions & 2 deletions crates/net/ecies/src/algorithm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ fn ecdh_x(public_key: &PublicKey, secret_key: &SecretKey) -> B256 {
/// # Panics
/// * If the `dest` is empty
/// * If the `dest` len is greater than or equal to the hash output len * the max counter value. In
/// this case, the hash output len is 32 bytes, and the max counter value is 2^32 - 1. So the dest
/// cannot have a len greater than 32 * 2^32 - 1.
/// this case, the hash output len is 32 bytes, and the max counter value is 2^32 - 1. So the dest
/// cannot have a len greater than 32 * 2^32 - 1.
fn kdf(secret: B256, s1: &[u8], dest: &mut [u8]) {
concat_kdf::derive_key_into::<Sha256>(secret.as_slice(), s1, dest).unwrap();
}
Expand Down
2 changes: 1 addition & 1 deletion crates/net/eth-wire-types/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ impl From<EthBroadcastMessage> for ProtocolBroadcastMessage {
/// The ethereum wire protocol is a set of messages that are broadcast to the network in two
/// styles:
/// * A request message sent by a peer (such as [`GetPooledTransactions`]), and an associated
/// response message (such as [`PooledTransactions`]).
/// response message (such as [`PooledTransactions`]).
/// * A message that is broadcast to the network, without a corresponding request.
///
/// The newer `eth/66` is an efficiency upgrade on top of `eth/65`, introducing a request id to
Expand Down
2 changes: 1 addition & 1 deletion crates/node-core/src/args/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ pub enum SocketAddressParsingError {
/// The following formats are checked:
///
/// - If the value can be parsed as a `u16` or starts with `:` it is considered a port, and the
/// hostname is set to `localhost`.
/// hostname is set to `localhost`.
/// - If the value contains `:` it is assumed to be the format `<host>:<port>`
/// - Otherwise it is assumed to be a hostname
///
Expand Down
1 change: 1 addition & 0 deletions crates/node-core/src/dirs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ impl<D> From<PathBuf> for MaybePlatformPath<D> {
/// * mainnet: `<DIR>/mainnet`
/// * goerli: `<DIR>/goerli`
/// * sepolia: `<DIR>/sepolia`
///
/// Otherwise, the path will be dependent on the chain ID:
/// * `<DIR>/<CHAIN_ID>`
#[derive(Clone, Debug, PartialEq, Eq)]
Expand Down
2 changes: 1 addition & 1 deletion crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ optimism = [
"reth-provider/optimism",
"reth-interfaces/optimism",
"revm-primitives/optimism",
]
]
85 changes: 43 additions & 42 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,48 +357,49 @@ where
block.withdrawals.as_ref().map(Withdrawals::as_ref),
);

#[cfg(all(feature = "optimism", feature = "opbnb"))]
if self.chain_spec.fork(Hardfork::PreContractForkBlock).transitions_at_block(block.number) {
// WBNBContract WBNB preDeploy contract address
let w_bnb_contract_address =
Address::from_str("0x4200000000000000000000000000000000000006").unwrap();
let mut w_bnb_storage = PlainStorage::new();
// insert storage for wBNB contract
// nameSlot { Name: "Wrapped BNB" }
w_bnb_storage.insert(
U256::from_str(
"0x0000000000000000000000000000000000000000000000000000000000000000",
)
.unwrap(),
U256::from_str(
"0x5772617070656420424e42000000000000000000000000000000000000000016",
)
.unwrap(),
);
// symbolSlot { Symbol: "wBNB" }
w_bnb_storage.insert(
U256::from_str(
"0x0000000000000000000000000000000000000000000000000000000000000001",
)
.unwrap(),
U256::from_str(
"0x57424e4200000000000000000000000000000000000000000000000000000008",
)
.unwrap(),
);
// insert wBNB contract with storage
self.db_mut().insert_account_with_storage(
w_bnb_contract_address,
AccountInfo::default(),
w_bnb_storage,
);
// GovernanceToken contract address
let governance_token_contract_address =
Address::from_str("0x4200000000000000000000000000000000000042").unwrap();
// destruct the governance token contract
self.evm
.selfdestruct(governance_token_contract_address, governance_token_contract_address);
}
// TODO: rebase with the fix
// #[cfg(all(feature = "optimism", feature = "opbnb"))]
// if self.chain_spec.fork(Hardfork::PreContractForkBlock).transitions_at_block(block.
// number) { // WBNBContract WBNB preDeploy contract address
// let w_bnb_contract_address =
// Address::from_str("0x4200000000000000000000000000000000000006").unwrap();
// let mut w_bnb_storage = PlainStorage::new();
// // insert storage for wBNB contract
// // nameSlot { Name: "Wrapped BNB" }
// w_bnb_storage.insert(
// U256::from_str(
// "0x0000000000000000000000000000000000000000000000000000000000000000",
// )
// .unwrap(),
// U256::from_str(
// "0x5772617070656420424e42000000000000000000000000000000000000000016",
// )
// .unwrap(),
// );
// // symbolSlot { Symbol: "wBNB" }
// w_bnb_storage.insert(
// U256::from_str(
// "0x0000000000000000000000000000000000000000000000000000000000000001",
// )
// .unwrap(),
// U256::from_str(
// "0x57424e4200000000000000000000000000000000000000000000000000000008",
// )
// .unwrap(),
// );
// // insert wBNB contract with storage
// self.db_mut().insert_account_with_storage(
// w_bnb_contract_address,
// AccountInfo::default(),
// w_bnb_storage,
// );
// // GovernanceToken contract address
// let governance_token_contract_address =
// Address::from_str("0x4200000000000000000000000000000000000042").unwrap();
// // destruct the governance token contract
// self.evm
// .selfdestruct(governance_token_contract_address,
// governance_token_contract_address); }

// increment balances
self.state
Expand Down
Loading

0 comments on commit b0189bd

Please sign in to comment.