diff --git a/cmd/wavelet/events.go b/cmd/wavelet/events.go index 599beb17..067a0b1b 100644 --- a/cmd/wavelet/events.go +++ b/cmd/wavelet/events.go @@ -42,7 +42,6 @@ func setEvents(c *wctl.Client) (func(), error) { c.OnGasBalanceUpdated = onGasBalanceUpdated c.OnStakeUpdated = onStakeUpdated c.OnRewardUpdated = onRewardUpdate - c.OnNonceUpdated = onNonceUpdated if err := addToCloser(&toClose)(c.PollAccounts()); err != nil { return cleanup, err @@ -169,13 +168,6 @@ func onRewardUpdate(u wctl.RewardUpdated) { Msg("Reward updated.") } -func onNonceUpdated(u wctl.NonceUpdated) { - logger.Info(). - Hex("public_key", u.AccountID[:]). - Uint64("nonce", u.Nonce). - Msg("Nonce updated.") -} - func onPeerJoin(u wctl.PeerJoin) { logger.Info(). Hex("public_key", u.AccountID[:]). diff --git a/collapse.go b/collapse.go index 6ff2157a..81840c66 100644 --- a/collapse.go +++ b/collapse.go @@ -131,7 +131,6 @@ type CollapseContext struct { balances map[AccountID]uint64 stakes map[AccountID]uint64 rewards map[AccountID]uint64 - nonces map[AccountID]uint64 contracts map[TransactionID][]byte contractGasBalances map[TransactionID]uint64 contractVMs map[AccountID]*VMState @@ -160,7 +159,6 @@ func (c *CollapseContext) init() { c.balances = make(map[AccountID]uint64) c.stakes = make(map[AccountID]uint64) c.rewards = make(map[AccountID]uint64) - c.nonces = make(map[AccountID]uint64) c.contracts = make(map[TransactionID][]byte) c.contractGasBalances = make(map[TransactionID]uint64) c.contractVMs = make(map[AccountID]*VMState) diff --git a/site/docs/transactions.md b/site/docs/transactions.md index a8a9a498..dd0d3861 100644 --- a/site/docs/transactions.md +++ b/site/docs/transactions.md @@ -47,17 +47,6 @@ Upon the creation of a transaction, the transaction creator would sign the tag, would play the role of being the transactions sender. The sender would then assign consensus-related information to the transaction, sign the entirety of the transaction, and broadcast it out to the network to be verified and finalized by other Wavelet nodes. -## Replay Attacks - -A nonce is associated to each and every Wavelet account. A nonce is an incremental, ascending counter that gets incremented every single time a transaction -that was created by some given account gets finalized and apply to the ledgers state. - -The nonce is used to prevent replay attacks, where after an account creates a transaction, there may exist a possibility that several nodes may attempt -to re-sign the transaction such that the transaction may operate and be applied on the ledger indefinite amounts of times. - -By attaching a nonce counter, once a single instance of some accounts transaction gets finalized, no other node may re-sign and re-broadcast the transaction -to cause a replay attack. - ## Binary Format Transactions are encoded using a simple binary encoding scheme, where all integers are little-endian encoded, and all variable-sized arrays are @@ -70,7 +59,7 @@ The current binary format of a Wavelet transaction is denoted as follows: | Flag | A single byte that is 1 if the Creator Account ID is the same as the Sender Account ID, and is 0 otherwise. | | Sender Account ID | 256-bit wallet address/public key. | | Creator Account ID | 256-bit wallet address/public key. | -| Nonce | Latest nonce value of the creators account, denoted as an unsigned 64-bit little-endian integer. | +| Nonce | Unique value, denoted as an unsigned 64-bit little-endian integer. | | Parent IDs | Length-prefixed array of 256-bit transaction IDs; assigned by the transactions sender. | | Parent Seeds | Array of 256-bit transaction seeds, with the same length as the Parent IDs field and therefore not length-prefixed; must correspond to the transactions specified by Parent IDs. | | Depth | Unsigned 64-bit little-endian integer; assigned by the transactions sender. | diff --git a/vote_test.go b/vote_test.go index 07afa978..66bcb7a1 100644 --- a/vote_test.go +++ b/vote_test.go @@ -533,4 +533,4 @@ func TestCollectVotesForSync(t *testing.T) { assert.False(t, snowball.Decided()) }) -} \ No newline at end of file +} diff --git a/wctl/wctl.go b/wctl/wctl.go index 63bf52a1..bfc2a71b 100644 --- a/wctl/wctl.go +++ b/wctl/wctl.go @@ -104,7 +104,6 @@ type Client struct { OnNumPagesUpdated OnStakeUpdated OnRewardUpdated - OnNonceUpdated // Network OnPeerJoin diff --git a/wctl/ws_callbacks.go b/wctl/ws_callbacks.go index 5897e0e0..ed1ca77b 100644 --- a/wctl/ws_callbacks.go +++ b/wctl/ws_callbacks.go @@ -43,13 +43,6 @@ type ( Time time.Time `json:"time"` } OnRewardUpdated = func(RewardUpdated) - - NonceUpdated struct { - AccountID [32]byte `json:"account_id"` - Nonce uint64 `json:"nonce"` - Time time.Time `json:"time"` - } - OnNonceUpdated = func(NonceUpdated) ) // Mod: network