Skip to content

Conversation

ecol-master
Copy link
Member

@ecol-master ecol-master commented Sep 9, 2025

@ecol-master ecol-master linked an issue Sep 9, 2025 that may be closed by this pull request
Copy link

semanticdiff-com bot commented Sep 9, 2025

Review changes with  SemanticDiff

Changed Files
File Status
  ethexe/ethereum/WrappedVara.json  100% smaller
  ethexe/consensus/src/validator/subordinate.rs  90% smaller
  ethexe/consensus/src/validator/coordinator.rs  76% smaller
  ethexe/ethereum/src/middleware/mod.rs  73% smaller
  ethexe/processor/src/handling/events.rs  71% smaller
  ethexe/consensus/src/validator/initial.rs  68% smaller
  ethexe/service/src/tests/utils/env.rs  51% smaller
  ethexe/consensus/src/validator/mod.rs  48% smaller
  ethexe/consensus/src/validator/producer.rs  47% smaller
  ethexe/ethereum/src/lib.rs  44% smaller
  ethexe/consensus/src/validator/mock.rs  38% smaller
  ethexe/db/src/database.rs  37% smaller
  ethexe/ethereum/src/router/mod.rs  35% smaller
  ethexe/observer/src/sync.rs  31% smaller
  ethexe/observer/src/lib.rs  28% smaller
  ethexe/common/src/db.rs  28% smaller
  ethexe/consensus/src/validator/core.rs  25% smaller
  ethexe/consensus/src/utils.rs  5% smaller
  ethexe/ethereum/src/deploy.rs  4% smaller
  ethexe/compute/src/prepare.rs  1% smaller
  ethexe/common/src/primitives.rs  1% smaller
  ethexe/service/src/tests/mod.rs  1% smaller
  Cargo.lock Unsupported file format
  Cargo.toml Unsupported file format
  ethexe/common/src/crypto/address.rs  0% smaller
  ethexe/common/src/events/router.rs  0% smaller
  ethexe/common/src/utils.rs  0% smaller
  ethexe/compute/src/service.rs  0% smaller
  ethexe/compute/src/tests.rs  0% smaller
  ethexe/consensus/Cargo.toml Unsupported file format
  ethexe/consensus/src/validator/submitter.rs  0% smaller
  ethexe/contracts/src/IRouter.sol Unsupported file format
  ethexe/contracts/src/Router.sol Unsupported file format
  ethexe/db/Cargo.toml Unsupported file format
  ethexe/ethereum/Middleware.json Unsupported file format
  ethexe/ethereum/Mirror.json Unsupported file format
  ethexe/ethereum/Router.json Unsupported file format
  ethexe/ethereum/src/abi/events/router.rs  0% smaller
  ethexe/ethereum/src/abi/mod.rs  0% smaller
  ethexe/observer/Cargo.toml Unsupported file format
  ethexe/processor/src/lib.rs  0% smaller
  ethexe/service/src/fast_sync.rs Unsupported file format
  ethexe/service/src/tests/utils/mod.rs  0% smaller
  ethexe/service/src/tests/utils/symbiotic.rs  0% smaller

@ecol-master ecol-master force-pushed the 4382-ethexe-next-era-validators-support-in-validators branch from 908490a to b3726f6 Compare September 12, 2025 14:04
}

// #[tokio::test(flavor = "multi_thread")]
// #[ntest::timeout(60_000)]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO impl test for validators commitment

@ecol-master ecol-master self-assigned this Sep 12, 2025
@ecol-master ecol-master added A1-inprogress Issue is in progress or PR draft is not ready to be reviewed Q4-epic D8-gearexe gear.exe-related PR labels Sep 12, 2025
@ecol-master ecol-master changed the title feat(ethexe): Producer validators commitment feat(ethexe-consensus): implement logic to change validator set for the next era Sep 14, 2025
@grishasobol grishasobol self-requested a review September 15, 2025 11:27

# there are patches to disable `memory.grow` and to add offset of reserved memory
wasm-smith = { version = "0.230", git = "https://github.com/gear-tech/wasm-tools", branch = "gear-stable-1.230" }
wasm-smith = { version = "0.230", git = "https://github.com/gear-tech/wasm-tools", branch = "gear-stable-1.230" }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\n

#[debug("ValidatorsVec must be non-empty")]
pub struct TryFromVecError;

// Usefull conversions from / to `Vec<Address>`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useful


#[derive(Debug, Display, Error)]
#[display("{:?}", self)]
#[debug("ValidatorsVec must be non-empty")]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[debug("ValidatorsVec must be non-empty")]
#[debug("Vec must be non-empty")]


self.transitions.register_new(actor_id);
}
RouterRequestEvent::NextEraValidatorsCommitted { era_index } => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Processor is not responsible for this kind of events

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move it to observer

let timelines = self
.db
.gear_exe_timelines()
.ok_or(anyhow!("not fonud gear exe timelines in db"))?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
.ok_or(anyhow!("not fonud gear exe timelines in db"))?;
.ok_or(anyhow!("not found gear exe timelines in db"))?;


self.mark_chain_as_synced(chain.into_iter().rev());
self.propagate_validators(block, header).await?;
self.propagate_validators_info(block, &header).await?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

propagate_validators_info must be done before mark_chain_as_synced

/// The state switches to [`NextEraValidators::Elected`] at the election checkpoint by calling `makeElectionAt` in the middleware.
/// After the commitment is included in a block, the state switches to [`NextEraValidators::Committed`].
#[derive(Debug, Clone, Default, PartialEq, Eq, Encode, Decode)]
pub enum NextEraValidators {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like idea of storing next era validators in DB. Why:

  1. Observer must make election - this is ok right now, but should be moved to consensus service in future (consensus call rpc by self)
  2. Elected, but not committed validators could be stored in consensus service memory, which is much simpler implementation
  3. In propagate_validators_info - is the only one case where you use it. It removes rpc access once per era, but increase code complexity all over gear exe code, I don't think is fare trade

/// Static data stored in the database.
/// Expected to be unmutable and set only once.
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Encode, Decode)]
pub struct StaticData {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use LatestData

@ecol-master ecol-master changed the title feat(ethexe-consensus): implement logic to change validator set for the next era feat(ethexe-consensus): implement changing validator set for the next era Sep 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A1-inprogress Issue is in progress or PR draft is not ready to be reviewed D8-gearexe gear.exe-related PR Q4-epic
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ethexe: next era validators support in gear.exe
2 participants