Skip to content

RFC: DevMode Improvements#5003

Closed
winder wants to merge 13 commits into
algorand:masterfrom
winder:will/timeskip
Closed

RFC: DevMode Improvements#5003
winder wants to merge 13 commits into
algorand:masterfrom
winder:will/timeskip

Conversation

@winder
Copy link
Copy Markdown
Contributor

@winder winder commented Jan 11, 2023

Summary

Adds a new dev-mode only consensus option to enable dev-mode specific transaction fields. Implement two features with these fields:

  • overriding the block header timestamp
  • skipping transaction validation

Note: This PR includes changes to simplify private network management

Examples

goal network create --rootdir mynetwork --devMode --start

# setup bash environment
export ALGORAND_DATA=./devmode_test/Node
TOKEN=$(cat $ALGORAND_DATA/algod.token)
ADDR=$(cat $ALGORAND_DATA/algod.net)
ACCOUNT_1=$(goal account list | head -n 1 | cut -f 2)
ACCOUNT_2=$(goal account list | tail -n 1 | cut -f 2)

# send a transaction to set the block time
goal clerk send --amount 100000000 --from $ACCOUNT_1 --to $ACCOUNT_1 --set-block-time 99999999

# look at block 1, it should have the specified
curl -sq -H "Authorization: Bearer $TOKEN" "$ADDR/v2/blocks/1"

# look closer
curl -sq -H "Authorization: Bearer $TOKEN" "$ADDR/v2/blocks/1" | grep 99999999

# you can also skip validation. This transaction should fail:
goal clerk send --amount 100000000 --from $ACCOUNT_1 --to $ACCOUNT_1 --signer $ACCOUNT_2

# now it succeeds
goal clerk send --amount 100000000 --from $ACCOUNT_1 --to $ACCOUNT_1 --signer $ACCOUNT_2 --skip-validation

# inspect the transaction to see how it works
goal clerk send --amount 100000000 --from $ACCOUNT_1 --to $ACCOUNT_1 --set-block-time 99999999 -o blocktime.txn
msgpacktool -d < blocktime.txn

Test Plan

TODO. So far only manual testing has been done.

@winder winder changed the title DevMode Improvements RFC: DevMode Improvements Jan 11, 2023
Comment thread cmd/goal/application.go Outdated
Comment thread cmd/goal/network.go
@@ -17,9 +17,12 @@
package main
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this file, these are private network changes from another PR.

Comment thread netdeploy/network.go
@@ -19,6 +19,7 @@ package netdeploy
import (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this file, these are private network changes from another PR.

@@ -172,6 +172,11 @@ func loadTemplate(templateFile string) (NetworkTemplate, error) {
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this file, these are private network changes from another PR.

Comment thread node/node.go
Comment on lines +189 to +197
// TODO: Have a real security model. Some ideas:
// * devmode now uses a custom consensus.json file which sets this value.
// * private forks have a one time special block that changes the consensus version.
// * 'devmode' is like 'future'
// go ahead and put the "hack" in hackathon.
for idx, proto := range config.Consensus {
proto.DevMode = true
config.Consensus[idx] = proto
}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

For the hackathon, this is how I set the new variable. Some new policy would be required for setting up a network that sets DevMode to true.

@@ -19,6 +19,7 @@ package fixtures
import (
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ignore this file, these are private network changes from another PR.

@winder winder closed this Apr 19, 2023
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.

1 participant