Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add versioning to mainnet update 2.5 #4711

Draft
wants to merge 86 commits into
base: mainnet_2_3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
6c3858c
Asc message execution - requery message bytecode after each message e…
Leo-Besancon Jun 18, 2024
c316e44
Create MIP "MIP-0001-ASC-BugFix"
Leo-Besancon Jun 18, 2024
ab29c86
Add versioning to asc execution context
Leo-Besancon Jun 18, 2024
93b2b3b
Asc message execution - requery message bytecode after each message e…
Leo-Besancon Jun 18, 2024
ca5eaf2
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Jun 18, 2024
b5c548c
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Jul 17, 2024
a7cc744
Improve versioning
Leo-Besancon Jul 18, 2024
4f89e6a
fmt
Leo-Besancon Jul 18, 2024
f581540
Update ci.yml
Leo-Besancon Jul 18, 2024
72bd77c
Add ledger changes versioning
Leo-Besancon Jul 18, 2024
44a1874
Add runtime module versioning
Leo-Besancon Jul 18, 2024
59a5052
Add send_message versioning
Leo-Besancon Jul 18, 2024
361427f
Add address category versioning
Leo-Besancon Jul 18, 2024
99d8abe
Add Fix eliminated msg versioning
Leo-Besancon Jul 18, 2024
5df2700
add versioning test-exports mip
Leo-Besancon Jul 23, 2024
f848daa
fmt
Leo-Besancon Jul 23, 2024
9ea25d4
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Aug 1, 2024
5aa1fb8
Add ledger delete_entry versioning
Leo-Besancon Aug 1, 2024
0eb5ffc
Add versioning for Consistent expiry period
Leo-Besancon Aug 1, 2024
462caa7
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Aug 1, 2024
d1224b4
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Aug 1, 2024
6b19df6
Update speculative_async_pool.rs
Leo-Besancon Aug 1, 2024
8de2a7d
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Aug 1, 2024
f78ee71
Add versioning to fees fix
Leo-Besancon Aug 1, 2024
a4da3c5
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Aug 2, 2024
4ca00b0
Add versioning for Fix amount remaining to slash 2
Leo-Besancon Aug 2, 2024
133af5a
Fix conflict
Leo-Besancon Aug 2, 2024
de4bf07
Add versioning for LedgerChanges::Delete
Leo-Besancon Aug 2, 2024
15fe3ea
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 7, 2024
f6d2f97
cargo fmt + check pass
Leo-Besancon Nov 7, 2024
641b99e
Add Condom Middleware versioning
Leo-Besancon Nov 7, 2024
9ddf5ae
fmt
Leo-Besancon Nov 7, 2024
d40efaa
Add versioning to max_recursive_calls_depth
Leo-Besancon Nov 7, 2024
7ed039a
Fix deadlock
Leo-Besancon Nov 7, 2024
84c0e4c
Add versioning to Fix potential ledger keys boundaries issue
Leo-Besancon Nov 8, 2024
fd98eda
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 15, 2024
3f1262b
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 15, 2024
1acd921
Add versioning to gas costs
Leo-Besancon Nov 15, 2024
a02f301
Add versioning to Add additional verification for v & s value in evm_…
Leo-Besancon Nov 15, 2024
8468653
Update runtime dep
Leo-Besancon Nov 15, 2024
56c53ad
Add comment relative to versioning of Update executed denunciations i…
Leo-Besancon Nov 15, 2024
a862f23
Add versioning to Limit event msg size & event number per operation
Leo-Besancon Nov 15, 2024
706d558
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 15, 2024
d3c3bf0
Fix versioning for interface implementation tests
Leo-Besancon Nov 15, 2024
315b850
Fix test for max_event size
Leo-Besancon Nov 15, 2024
ce0e14b
Add versioning to Early set operation id
Leo-Besancon Nov 19, 2024
9e2d0e5
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 22, 2024
82ed837
Review comment: propagate error message and better match
Leo-Besancon Nov 28, 2024
95b720d
Review comment: clean out match
Leo-Besancon Nov 28, 2024
fb37498
Review comment: Add helper function to query versioned condom_limits …
Leo-Besancon Nov 28, 2024
43d23d1
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Nov 28, 2024
b3e9ba5
Add comment
Leo-Besancon Nov 28, 2024
907b86f
Add dummy info for MIP_info
Leo-Besancon Nov 28, 2024
c46bf0c
Change .unwrap() to .expect() for get_block_timestamp
Leo-Besancon Dec 4, 2024
8b54a5e
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 4, 2024
fa099d0
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
modship Dec 4, 2024
6b03ad8
Disable deferred calls abi if exec_comp = 0
modship Dec 5, 2024
2c38062
deferred calls const gas cost
modship Dec 9, 2024
cb30010
Add versioning for fix async message updates and add unit test
Leo-Besancon Dec 10, 2024
820ed1e
Api : deferred call endpoint versioning
modship Dec 11, 2024
fc07bc5
Metrics: add network version metrics
modship Dec 12, 2024
ef95780
fix empty help msg
modship Dec 12, 2024
37edce7
Rollback deferred calls abi bail
modship Dec 16, 2024
eeda2f5
update runtime
modship Dec 16, 2024
faa8521
Allow transfers to SC addresses (#4789)
Leo-Besancon Dec 16, 2024
09cda31
Add versioning to Allow transfers to SC addresses
Leo-Besancon Dec 16, 2024
c90ede1
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 16, 2024
5ede1f1
Use coherent PublicKeyFormat in parse_slice (#4783)
sydhds Dec 16, 2024
8efc3fc
Fix incorrect address hashing + add TU for evm_get_address_from_pubke…
sydhds Dec 16, 2024
95eefb4
Add versioning to Use coherent PublicKeyFormat in parse_slice
Leo-Besancon Dec 16, 2024
5060ba4
Add versioning for Fix incorrect address hashing
Leo-Besancon Dec 16, 2024
47bfefd
cargo fmt + check
Leo-Besancon Dec 16, 2024
ee65688
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 16, 2024
647f24b
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 19, 2024
500a8e4
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 19, 2024
47aee0c
Add versioning to massa event cache
Leo-Besancon Dec 19, 2024
27ca46c
Fix versioning of massa event cache
Leo-Besancon Dec 19, 2024
39698eb
Reset cache if version becomes active (#4791)
Leo-Besancon Dec 30, 2024
514ce26
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 30, 2024
ce2b35d
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Dec 30, 2024
dee7e28
In HD DB reset(), Do not panic if fails to destroy HD cache
Leo-Besancon Dec 30, 2024
b2018c4
Fix async message execution order in slot with no active version (#4799)
Leo-Besancon Dec 31, 2024
582869d
current_mip_version to get_status (#4803)
modship Jan 3, 2025
f935f47
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Jan 6, 2025
fa9acda
Fix versioned TU
Leo-Besancon Jan 6, 2025
1e4b911
Merge branch 'mainnet_2_3' into mainnet_2_3_versioning_mip
Leo-Besancon Jan 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,8 @@ massa_event_cache = { path = "./massa-event-cache" }
# Massa projects dependencies
# massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", branch = "deferred_calls" }
# massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "branch" = "deferred_calls" }
massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", "rev" = "b5267178eaf266ec724691d7de163e4c34343416" }
massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "f5a584b9f8050f332c9ed332bd0a40f8e0372807" }

massa-proto-rs = { git = "https://github.com/massalabs/massa-proto-rs", "rev" = "c9a7c55914f3d308996113df0936f15d96490313" }
massa-sc-runtime = { git = "https://github.com/massalabs/massa-sc-runtime", "rev" = "cd14c775aff31b8c0f49064613118f428f9dd45f" }

peernet = { git = "https://github.com/massalabs/PeerNet", "rev" = "04b05ddd320fbe76cc858115af7b5fc28bdb8310" }
# Dev only - use local dependencies
Expand Down
2 changes: 2 additions & 0 deletions massa-api-exports/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ pub struct NodeStatus {
pub chain_id: u64,
/// minimal fees to include an operation in a block
pub minimal_fees: Amount,
/// current mip version
pub current_mip_version: u32,
}

impl std::fmt::Display for NodeStatus {
Expand Down
37 changes: 37 additions & 0 deletions massa-api/src/public.rs
Original file line number Diff line number Diff line change
Expand Up @@ -458,6 +458,12 @@ impl MassaRpcServer for API<Public> {
let config = CompactConfig::default();
let now = MassaTime::now();

let current_mip_version = self
.0
.keypair_factory
.mip_store
.get_network_version_current();

let last_slot_result = get_latest_block_slot_at_timestamp(
api_settings.thread_count,
api_settings.t0,
Expand Down Expand Up @@ -555,6 +561,7 @@ impl MassaRpcServer for API<Public> {
current_cycle,
chain_id: self.0.api_settings.chain_id,
minimal_fees: self.0.api_settings.minimal_fees,
current_mip_version,
})
}

Expand Down Expand Up @@ -1160,6 +1167,16 @@ impl MassaRpcServer for API<Public> {
&self,
req: Vec<DeferredCallsQuoteRequest>,
) -> RpcResult<Vec<DeferredCallsQuoteResponse>> {
let current_network_version = self
.0
.keypair_factory
.mip_store
.get_network_version_current();

if current_network_version < 1 {
return Err(ApiError::NotFound.into());
}

if req.len() as u64 > self.0.api_settings.max_arguments {
return Err(ApiError::BadRequest("too many arguments".into()).into());
}
Expand Down Expand Up @@ -1205,6 +1222,16 @@ impl MassaRpcServer for API<Public> {
&self,
arg: Vec<String>,
) -> RpcResult<Vec<DeferredCallResponse>> {
let current_network_version = self
.0
.keypair_factory
.mip_store
.get_network_version_current();

if current_network_version < 1 {
return Err(ApiError::NotFound.into());
}

if arg.len() as u64 > self.0.api_settings.max_arguments {
return Err(ApiError::BadRequest("too many arguments".into()).into());
}
Expand Down Expand Up @@ -1245,6 +1272,16 @@ impl MassaRpcServer for API<Public> {
&self,
slots: Vec<Slot>,
) -> RpcResult<Vec<DeferredCallsSlotResponse>> {
let current_network_version = self
.0
.keypair_factory
.mip_store
.get_network_version_current();

if current_network_version < 1 {
return Err(ApiError::NotFound.into());
}

if slots.len() as u64 > self.0.api_settings.max_arguments {
return Err(ApiError::BadRequest("too many arguments".into()).into());
}
Expand Down
6 changes: 3 additions & 3 deletions massa-bootstrap/src/tests/universe_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ impl BootstrapServerTestUniverseBuilder {
let mut batch = DBBatch::default();
let versioning_batch = DBBatch::default();
self.final_ledger
.apply_changes_to_batch(ledger_changes, &mut batch);
.apply_changes_to_batch(ledger_changes, &mut batch, 1);
self.controllers
.database
.write()
Expand All @@ -216,7 +216,7 @@ impl BootstrapServerTestUniverseBuilder {
let mut batch = DBBatch::default();
let versioning_batch = DBBatch::default();
self.final_ledger
.apply_changes_to_batch(ledger_changes, &mut batch);
.apply_changes_to_batch(ledger_changes, &mut batch, 1);
self.controllers
.database
.write()
Expand All @@ -232,7 +232,7 @@ impl BootstrapServerTestUniverseBuilder {
let mut batch = DBBatch::default();
let versioning_batch = DBBatch::default();
self.final_ledger
.apply_changes_to_batch(ledger_changes, &mut batch);
.apply_changes_to_batch(ledger_changes, &mut batch, 1);
self.controllers
.database
.write()
Expand Down
1 change: 1 addition & 0 deletions massa-client/src/display.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ impl Output for NodeStatus {

println!();
println!("Chain id: {}", self.chain_id);
println!("Current MIP version: {}", self.current_mip_version);
}
}

Expand Down
4 changes: 2 additions & 2 deletions massa-event-cache/src/event_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -944,7 +944,7 @@ mod tests {
use tempfile::TempDir;
// internal
use massa_models::config::{
MAX_EVENT_DATA_SIZE, MAX_EVENT_PER_OPERATION, MAX_OPERATIONS_PER_BLOCK,
MAX_EVENT_DATA_SIZE_V1, MAX_EVENT_PER_OPERATION, MAX_OPERATIONS_PER_BLOCK,
MAX_RECURSIVE_CALLS_DEPTH, THREAD_COUNT,
};
use massa_models::operation::OperationId;
Expand All @@ -959,7 +959,7 @@ mod tests {
300,
THREAD_COUNT,
MAX_RECURSIVE_CALLS_DEPTH,
MAX_EVENT_DATA_SIZE as u64,
MAX_EVENT_DATA_SIZE_V1 as u64,
MAX_EVENT_PER_OPERATION as u64,
MAX_OPERATIONS_PER_BLOCK as u64,
5000, // MAX_EVENTS_PER_QUERY,
Expand Down
19 changes: 19 additions & 0 deletions massa-execution-exports/src/mapping_grpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ use massa_proto_rs::massa::model::v1 as grpc_model;
/// Convert a `grpc_api::ScExecutionEventsRequest` to a `ScExecutionEventsRequest`
pub fn to_querystate_filter(
query: grpc_api::ExecutionQueryRequestItem,
network_version: u32,
) -> Result<ExecutionQueryRequestItem, ModelsError> {
if let Some(item) = query.request_item {
match item {
Expand Down Expand Up @@ -135,6 +136,12 @@ pub fn to_querystate_filter(
Ok(ExecutionQueryRequestItem::Events(event_filter))
}
exec::RequestItem::DeferredCallQuote(value) => {
if network_version < 1 {
return Err(ModelsError::InvalidVersionError(
"deferred call quote is not supported in this network version".to_string(),
));
}

Ok(ExecutionQueryRequestItem::DeferredCallQuote {
target_slot: value
.target_slot
Expand All @@ -147,10 +154,22 @@ pub fn to_querystate_filter(
})
}
exec::RequestItem::DeferredCallInfo(info) => {
if network_version < 1 {
return Err(ModelsError::InvalidVersionError(
"deferred call quote is not supported in this network version".to_string(),
));
}

let id = DeferredCallId::from_str(&info.call_id)?;
Ok(ExecutionQueryRequestItem::DeferredCallInfo(id))
}
exec::RequestItem::DeferredCallsBySlot(value) => {
if network_version < 1 {
return Err(ModelsError::InvalidVersionError(
"deferred call quote is not supported in this network version".to_string(),
));
}

Ok(ExecutionQueryRequestItem::DeferredCallsBySlot(
value
.slot
Expand Down
4 changes: 3 additions & 1 deletion massa-execution-exports/src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ pub struct ExecutionConfig {
/// slot execution outputs channel capacity
pub broadcast_slot_execution_output_channel_capacity: usize,
/// max size of event data, in bytes
pub max_event_size: usize,
pub max_event_size_v0: usize,
/// max size of event data, in bytes
pub max_event_size_v1: usize,
/// chain id
pub chain_id: u64,
/// whether slot execution traces broadcast is enabled
Expand Down
3 changes: 2 additions & 1 deletion massa-execution-exports/src/test_exports/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ impl Default for ExecutionConfig {
denunciation_expire_periods: DENUNCIATION_EXPIRE_PERIODS,
broadcast_enabled: true,
broadcast_slot_execution_output_channel_capacity: 5000,
max_event_size: 512,
max_event_size_v0: 50_000,
max_event_size_v1: 512,
max_event_per_operation: 25,
max_function_length: 1000,
max_parameter_length: 1000,
Expand Down
2 changes: 2 additions & 0 deletions massa-execution-worker/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ test-exports = [
"massa_pos_worker",
"massa_metrics/test-exports",
"massa_metrics/test-exports",
"massa_versioning/test-exports",
"massa_db_worker",
"massa_event_cache/test-exports",
"tempfile",
Expand Down Expand Up @@ -109,6 +110,7 @@ massa_metrics = { workspace = true, features = ["test-exports"] }
massa_db_worker = { workspace = true }
tempfile = { workspace = true }
massa_test_framework = { workspace = true, "features" = ["test-exports"] }
massa_versioning = { workspace = true, "features" = ["test-exports"] }
tokio = { workspace = true, features = ["sync"] }
hex-literal = { workspace = true }
mockall = { workspace = true }
Expand Down
26 changes: 16 additions & 10 deletions massa-execution-worker/src/active_history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ impl ActiveHistory {
&self,
message_id: &AsyncMessageId,
mut current_updates: AsyncMessageUpdate,
execution_compound_version: u32,
) -> HistorySearchResult<SetUpdateOrDelete<AsyncMessage, AsyncMessageUpdate>> {
for history_element in self.0.iter().rev() {
match history_element
Expand All @@ -81,11 +82,16 @@ impl ActiveHistory {
msg.apply(current_updates);
return HistorySearchResult::Present(SetUpdateOrDelete::Set(msg));
}
Some(SetUpdateOrDelete::Update(msg_update)) => {
let mut combined_message_update = msg_update.clone();
combined_message_update.apply(current_updates);
current_updates = combined_message_update;
}
Some(SetUpdateOrDelete::Update(msg_update)) => match execution_compound_version {
0 => {
current_updates.apply(msg_update.clone());
}
_ => {
let mut combined_message_update = msg_update.clone();
combined_message_update.apply(current_updates);
current_updates = combined_message_update;
}
},
Some(SetUpdateOrDelete::Delete) => return HistorySearchResult::Absent,
_ => (),
}
Expand Down Expand Up @@ -498,14 +504,14 @@ mod test {
// Test fetch_message with message_id (expect HistorySearchResult::Absent)
{
let current_updates = AsyncMessageUpdate::default();
let fetched = active_history.fetch_message(&message_id, current_updates);
let fetched = active_history.fetch_message(&message_id, current_updates, 1);
assert_matches!(fetched, HistorySearchResult::Absent);
}

// Test fetch_message with message_id_2 (expect HistorySearchResult::Set)
{
let current_updates = AsyncMessageUpdate::default();
let fetched = active_history.fetch_message(&message_id_2, current_updates);
let fetched = active_history.fetch_message(&message_id_2, current_updates, 1);

if let HistorySearchResult::Present(SetUpdateOrDelete::Set(msg)) = fetched {
assert_eq!(msg, msg_2);
Expand All @@ -526,7 +532,7 @@ mod test {
validity_end: SetOrKeep::Set(validity_end_new),
..Default::default()
};
let fetched = active_history.fetch_message(&message_id_2, current_updates);
let fetched = active_history.fetch_message(&message_id_2, current_updates, 1);

if let HistorySearchResult::Present(SetUpdateOrDelete::Set(msg)) = fetched {
assert_ne!(msg, msg_2);
Expand All @@ -542,7 +548,7 @@ mod test {
// Test fetch_message with message_id_3 (expect HistorySearchResult::Present)
{
let current_updates = AsyncMessageUpdate::default();
let fetched = active_history.fetch_message(&message_id_3, current_updates);
let fetched = active_history.fetch_message(&message_id_3, current_updates, 1);

if let HistorySearchResult::Present(SetUpdateOrDelete::Set(msg)) = fetched {
// Check the updates were applied correctly
Expand All @@ -561,7 +567,7 @@ mod test {
// Expect updates to be empty (or default) here
{
let current_updates = AsyncMessageUpdate::default();
let fetched = active_history.fetch_message(&message_id_3_2, current_updates);
let fetched = active_history.fetch_message(&message_id_3_2, current_updates, 1);
if let HistorySearchResult::Present(SetUpdateOrDelete::Update(updates)) = fetched {
assert_eq!(updates, AsyncMessageUpdate::default());
} else {
Expand Down
Loading
Loading