diff --git a/crates/rooch-framework/doc/account.md b/crates/rooch-framework/doc/account.md index 47e3409795..847b59332f 100644 --- a/crates/rooch-framework/doc/account.md +++ b/crates/rooch-framework/doc/account.md @@ -419,15 +419,16 @@ Return the current sequence number at addr
public(friend) fun increment_sequence_number(ctx: &mut Context) {
    let sender = context::sender(ctx);
+   let tx_sequence_number = context::sequence_number(ctx);
 
-   let sequence_number = &mut account_storage::global_borrow_mut<Account>(ctx, sender).sequence_number;
+   let account = account_storage::global_borrow_mut<Account>(ctx, sender);
 
    assert!(
-      (*sequence_number as u128) < MAX_U64,
+      (account.sequence_number as u128) < MAX_U64,
       error::out_of_range(ErrorSequenceNumberTooBig)
    );
 
-   *sequence_number = *sequence_number + 1;
+   account.sequence_number = tx_sequence_number + 1;
 }
 
diff --git a/crates/rooch-framework/doc/transaction_validator.md b/crates/rooch-framework/doc/transaction_validator.md index 8f576f976c..f4533cb1f3 100644 --- a/crates/rooch-framework/doc/transaction_validator.md +++ b/crates/rooch-framework/doc/transaction_validator.md @@ -174,10 +174,13 @@ If the authenticator is invaid, abort this function. // Check that the transaction's sequence number matches the // current sequence number. Otherwise sequence number is too new. - assert!( - tx_sequence_number == account_sequence_number, - error::invalid_argument(ErrorValidateSequenceNumberTooNew) - ); + //FIXME we temporarily disable this check, in order to improve the devnet experience + //Because the devnet will be reset frequently, so the sequence number will be reset to 0 + //But the sequence number(nonce) in MetaMask will not be reset, so the transaction will be rejected + // assert!( + // tx_sequence_number == account_sequence_number, + // error::invalid_argument(ErrorValidateSequenceNumberTooNew) + // ); let sender = context::sender(ctx); diff --git a/crates/rooch-framework/sources/account.move b/crates/rooch-framework/sources/account.move index 6f2851cea7..082743a637 100644 --- a/crates/rooch-framework/sources/account.move +++ b/crates/rooch-framework/sources/account.move @@ -137,15 +137,16 @@ module rooch_framework::account { public(friend) fun increment_sequence_number(ctx: &mut Context) { let sender = context::sender(ctx); + let tx_sequence_number = context::sequence_number(ctx); - let sequence_number = &mut account_storage::global_borrow_mut(ctx, sender).sequence_number; + let account = account_storage::global_borrow_mut(ctx, sender); assert!( - (*sequence_number as u128) < MAX_U64, + (account.sequence_number as u128) < MAX_U64, error::out_of_range(ErrorSequenceNumberTooBig) ); - *sequence_number = *sequence_number + 1; + account.sequence_number = tx_sequence_number + 1; } /// Helper to return the sequence number field for given `account` diff --git a/crates/rooch-framework/sources/transaction_validator.move b/crates/rooch-framework/sources/transaction_validator.move index 401f5eb895..53bcb63bc2 100644 --- a/crates/rooch-framework/sources/transaction_validator.move +++ b/crates/rooch-framework/sources/transaction_validator.move @@ -70,10 +70,13 @@ module rooch_framework::transaction_validator { // Check that the transaction's sequence number matches the // current sequence number. Otherwise sequence number is too new. - assert!( - tx_sequence_number == account_sequence_number, - error::invalid_argument(ErrorValidateSequenceNumberTooNew) - ); + //FIXME we temporarily disable this check, in order to improve the devnet experience + //Because the devnet will be reset frequently, so the sequence number will be reset to 0 + //But the sequence number(nonce) in MetaMask will not be reset, so the transaction will be rejected + // assert!( + // tx_sequence_number == account_sequence_number, + // error::invalid_argument(ErrorValidateSequenceNumberTooNew) + // ); let sender = context::sender(ctx);