Skip to content

Feature/dkg integration#302

Open
hsaleemsupra wants to merge 112 commits intodevfrom
feature/dkg-integration
Open

Feature/dkg integration#302
hsaleemsupra wants to merge 112 commits intodevfrom
feature/dkg-integration

Conversation

@hsaleemsupra
Copy link
Copy Markdown

No description provided.

hsaleemsupra and others added 16 commits January 16, 2026 10:07
* feat(types,accumulator): Add features for transactions inclusions and events emissions proofs.

- RLP's `Encodable` trait implementation for Contract Events.
- `get_proof_by_position` method for Merkle Accumulator.

* feat: add `EventV2` api type

* chore: cargo feature optimization

* refactor(aptos-api-types): transformed `Event` to `EventV1` and applied Full-Clone on `EventV2`

* feat: add `hash` in `EventV1` with serialization disabled

* docs: fix oai docs for `EventV1`

* feat(aptos_api_types): add `try_into_v2_events` to convert `ContractEvent` to `EventV2`

* feat: add `SUPRA_TRANSACTIONS_INCLUSION_PROOFS` feature flag

* feat: replace rlp encoding with custom encoding to generate event hash

* chore: replace `alloy` with `sha3` for `Keccak256` impl

* fix: Keccack256 hash implementation using `sha3`

---------

Co-authored-by: Nikita Puzankov <n.puzankov@supraoracles.com>
Co-authored-by: Simon Chen <s.chen@supraoracles.com>
@isaacdoidge isaacdoidge force-pushed the feature/dkg-integration branch from 50e66f6 to 2110584 Compare March 9, 2026 04:10
isaacdoidge and others added 11 commits March 9, 2026 14:46
…re flags are set, so updated implementation accordingly and added notes. Also fixed supra_governance::reconfigure.
)

* Started work towards adding leader ban registry config to genesis.

* added remaining changes for the leader ban config at genesis

* added deserilization step

* added deserilization step

* added deserilization step

* fixed leader ban registry package for ban parameters

* decoded correct version of params

---------

Co-authored-by: Dhaval Purohit <d.purohit@supraoracles.com>
Comment on lines -33 to +29
enum ExpectedFailure {
// Move equivalent: `errors::invalid_argument(*)`
EpochNotCurrent = 0x10001,
TranscriptDeserializationFailed = 0x10002,
TranscriptVerificationFailed = 0x10003,

// Move equivalent: `errors::invalid_state(*)`
MissingResourceDKGState = 0x30001,
MissingResourceInprogressDKGSession = 0x30002,
MissingResourceConfiguration = 0x30003,
}

enum ExecutionFailure {
Expected(ExpectedFailure),
Expected(DiscardedVMStatus),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems that the previous expected errors were more precise. Is there any risk in categorizing errors incorrectly?

})
.map_err(|r| Unexpected(r.unwrap_err()))?;
.map_err(|e| expect_only_successful_execution(e, function_name.as_str(), log_context))
.map_err(|r| ExecutionFailure::Unexpected(r.unwrap_err()))?;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

What does the executor do when it receives an unexpected error? We need to ensure that malicious nodes cannot cause their peers to crash by sending invalid inputs.

Comment on lines +2367 to +2370
session
.get_native_extensions()
.get_mut::<RandomnessContext>()
.mark_unbiasable();
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

We need to gate this with the DKG feature flag and also add a comment explaining that the randomness is still biasable during the first epoch in which the feature is activated because threshold keys are not available until the end of that epoch.

Comment on lines +66 to +84
// The order of the committee members is important for DKG.
// The order should correspond to the order of the validator committee.
// The output of the DKG has keys in the same order as the committee.
let dkg_committee = vector[];
vector::for_each(
validator_committee,
|x| {
let validator_keys_bytes = validator_consensus_info::get_pk_bytes(&x);
let addr = validator_consensus_info::get_addr(&x);
vector::push_back(
&mut dkg_committee,
DkgNodeConfig {
addr,
identity: bcs::to_bytes(&addr),
dkg_pubkey: validator_keys_bytes
}
);
}
);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Seems like it might be more robust to sort by node index.

Comment on lines +1849 to +1853
// on_new_epoch appends pending_active into active via pop_back, which reverses
// the order. Mirror that here so validator indices match after epoch transition.
let pending_idx =
num_cur_pending_actives - 1 - (candidate_idx - num_cur_actives);
vector::borrow(&cur_validator_set.pending_active, pending_idx)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Why do we not need to do this in next_validator_consensus_infos?

/// validators that are already active. This is used when starting DKG: the committee
/// membership (active + pending_active) must reflect the next epoch, but node config should reflect
/// current-epoch for the active validators.
public fun next_epoch_validator_consensus_infos_for_dkg(): vector<ValidatorConsensusInfo> acquires ValidatorSet, ValidatorPerformance, StakePool, ValidatorFees, ValidatorConfig {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

It seems like this function shares a lot of code with next_validator_consensus_infos. Is it possible to abstract the common functionality into new functions?

pub bls_aggregate_signature: Vec<u8>,
pub signer_indices_clan_committee: Vec<u32>,
pub transaction_type: u8,
pub payload: HexEncodedBytes,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please share this code if you've made the change.

crate::gas_schedule::macros::define_gas_parameters!(
SupraStdlibGasParameters,
"supra_stdlib",
NativeGasParameters => .supra_stdlib,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is still TODO.

@@ -1,5 +1,5 @@
[toolchain]
channel = "1.78.0"
channel = "1.89.0"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Let's update to 1.93 if we can do so easily, since that's what we're moving to in smr-moonshot.

@isaacdoidge isaacdoidge marked this pull request as ready for review April 1, 2026 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants