From 6de97c52bf6c2c45fca86899288a7e785058846f Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Tue, 10 Mar 2026 13:11:46 +0100 Subject: [PATCH 01/12] delete hardocoded IP address --- scripts/integration/local_tee_workflow.go | 20 ++++++++++++++------ scripts/tee-mgmt-cli/.env.example | 2 +- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/integration/local_tee_workflow.go b/scripts/integration/local_tee_workflow.go index 94ebe7f3..8c7a97ff 100755 --- a/scripts/integration/local_tee_workflow.go +++ b/scripts/integration/local_tee_workflow.go @@ -29,20 +29,21 @@ import ( "github.com/fxamacker/cbor/v2" ) -const ( +var ( RPC_URL = "http://127.0.0.1:8545" + ENCLAVE_HOST = getEnvOrDefault("TEE_ENCLAVE_HOST", "127.0.0.1") + ENCLAVE_PORT = getEnvOrDefault("TEE_ENCLAVE_PORT", "443") + MEASUREMENTS_PATH = getEnvOrDefault("TEE_MEASUREMENTS_PATH", "measurements.txt") VERIFIER_ADDRESS = "0x0000000000000000000000000000000000000900" - ENCLAVE_HOST = "3.15.214.21" - ENCLAVE_PORT = "443" - MEASUREMENTS_PATH = "measurements.txt" + TEE_REGISTRY_ADDRESS + ) -var TEE_REGISTRY_ADDRESS string // ============================================================================ // PASTE YOUR NEW COMPILED BYTECODE HERE // ============================================================================ -const TEE_REGISTRY_BYTECODE = "0x6080604052610708600655348015610015575f5ffd5b506100285f5f1b3361009160201b60201c565b506100597fae5084c516dacf3f1a818c437d702c28b8d2088455f592a7ea799413e3b6f1bf3361009160201b60201c565b5061008c7fae5084c516dacf3f1a818c437d702c28b8d2088455f592a7ea799413e3b6f1bf5f5f1b61018660201b60201c565b61026a565b5f6100a283836101e460201b60201c565b61017c5760015f5f8581526020019081526020015f205f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555061011961024760201b60201c565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050610180565b5f90505b92915050565b5f6101968361024e60201b60201c565b9050815f5f8581526020019081526020015f20600101819055508181847fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff60405160405180910390a4505050565b5f5f5f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b5f33905090565b5f5f5f8381526020019081526020015f20600101549050919050565b614a07806102775f395ff3fe608060405234801561000f575f5ffd5b5060043610610246575f3560e01c8063a217fddf11610139578063d2e03427116100b6578063e10a2ea41161007a578063e10a2ea41461077b578063e44cc482146107ab578063f0607aea146107db578063f33d2c00146107f7578063f44a07801461082757610246565b8063d2e03427146106c3578063d547741f146106e1578063d5ed579d146106fd578063d6741a421461072d578063dd3161131461075f57610246565b8063c0abde45116100fd578063c0abde4514610604578063c206baa314610620578063cbdfc4e014610650578063ccdf04931461066c578063d046a7fa146106a557610246565b8063a217fddf14610523578063b19ffd1c14610541578063b1c551ca14610574578063b778f869146105a4578063b82644b7146105d457610246565b806343ed3274116101c757806387267aca1161018b57806387267aca1461046a5780639138c99e1461048857806391cc00e9146104a457806391d14854146104d4578063971cfbf11461050457610246565b806343ed3274146103b6578063476cb030146103d25780634b19d463146104025780635c1090b21461041e5780635c36901c1461043a57610246565b80632f2ff15d1161020e5780632f2ff15d1461031457806336568abe146103305780633c1a88b01461034c578063418b207d1461036a57806342830ad81461039a57610246565b806301ffc9a71461024a57806308c84e701461027a578063097775c61461029857806315c9bdb4146102b4578063248a9ca3146102e4575b5f5ffd5b610264600480360381019061025f91906130b6565b610845565b60405161027191906130fb565b60405180910390f35b6102826108be565b60405161028f919061318e565b60405180910390f35b6102b260048036038101906102ad91906131da565b6108c4565b005b6102ce60048036038101906102c9919061332c565b610a74565b6040516102db9190613445565b60405180910390f35b6102fe60048036038101906102f991906131da565b61100e565b60405161030b9190613445565b60405180910390f35b61032e6004803603810190610329919061345e565b61102a565b005b61034a6004803603810190610345919061345e565b61104c565b005b6103546110c7565b6040516103619190613445565b60405180910390f35b610384600480360381019061037f91906131da565b6110eb565b6040516103919190613697565b60405180910390f35b6103b460048036038101906103af91906136e1565b611412565b005b6103d060048036038101906103cb9190613752565b6116a2565b005b6103ec60048036038101906103e791906137bf565b611709565b6040516103f99190613445565b60405180910390f35b61041c60048036038101906104179190613806565b61176b565b005b61043860048036038101906104339190613831565b61182f565b005b610454600480360381019061044f91906131da565b611846565b60405161046191906130fb565b60405180910390f35b610472611870565b60405161047f919061386b565b60405180910390f35b6104a2600480360381019061049d91906131da565b611876565b005b6104be60048036038101906104b991906131da565b6118e6565b6040516104cb9190613893565b60405180910390f35b6104ee60048036038101906104e9919061345e565b61196f565b6040516104fb91906130fb565b60405180910390f35b61050c6119d2565b60405161051a929190613a5c565b60405180910390f35b61052b611bed565b6040516105389190613445565b60405180910390f35b61055b600480360381019061055691906131da565b611bf3565b60405161056b9493929190613ad9565b60405180910390f35b61058e600480360381019061058991906131da565b611cb1565b60405161059b9190613b6b565b60405180910390f35b6105be60048036038101906105b991906131da565b611da2565b6040516105cb9190613b6b565b60405180910390f35b6105ee60048036038101906105e99190613806565b611e93565b6040516105fb9190613c33565b60405180910390f35b61061e60048036038101906106199190613c53565b611f00565b005b61063a60048036038101906106359190613cf3565b6120eb565b6040516106479190613445565b60405180910390f35b61066a60048036038101906106659190613d43565b612120565b005b610686600480360381019061068191906131da565b6122bd565b60405161069c9a99989796959493929190613daf565b60405180910390f35b6106ad6124f6565b6040516106ba9190613c33565b60405180910390f35b6106cb61254c565b6040516106d89190613c33565b60405180910390f35b6106fb60048036038101906106f6919061345e565b612697565b005b610717600480360381019061071291906131da565b6126b9565b60405161072491906130fb565b60405180910390f35b61074760048036038101906107429190613806565b61271c565b60405161075693929190613e5e565b60405180910390f35b610779600480360381019061077491906131da565b6127d4565b005b61079560048036038101906107909190613806565b61293f565b6040516107a291906130fb565b60405180910390f35b6107c560048036038101906107c09190613e9a565b61296e565b6040516107d29190613c33565b60405180910390f35b6107f560048036038101906107f091906131da565b612a01565b005b610811600480360381019061080c9190613752565b612a1a565b60405161081e9190613445565b60405180910390f35b61082f612a3b565b60405161083c9190613b6b565b60405180910390f35b5f7f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806108b757506108b682612ac7565b5b9050919050565b61090081565b5f60075f8381526020019081526020015f2090505f816007015403610915576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561097c575061097a5f5f1b3361196f565b155b156109b3576040517f98b31e6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060060160019054906101000a900460ff16156109d05750610a71565b6109dd81600501546126b9565b610a13576040517f6c2ebf8000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60018160060160016101000a81548160ff021916908315150217905550428160080181905550610a4282612b30565b817ff1107fa7ae6c5cdb1675a2191d02d30d03220d684e051e5c0632ca0458fe797460405160405180910390a2505b50565b5f7fae5084c516dacf3f1a818c437d702c28b8d2088455f592a7ea799413e3b6f1bf610a9f81612b74565b610aa88361293f565b610ade576040517f5d672da700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8989604051610aee929190613f01565b604051809103902091505f60075f8481526020019081526020015f206007015414610b45576040517f1346e43900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f61090073ffffffffffffffffffffffffffffffffffffffff1663f7cf40d38f8f8f8f8f8f60056040518863ffffffff1660e01b8152600401610b8f9796959493929190614035565b6040805180830381865afa158015610ba9573d5f5f3e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610bcd91906140d8565b9150915081610c11576040517f06d1f25a000000000000000000000000000000000000000000000000000000008152600401610c0890614160565b60405180910390fd5b610c1a816126b9565b610c50576040517f6c2ebf8000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040518061014001604052803373ffffffffffffffffffffffffffffffffffffffff1681526020018973ffffffffffffffffffffffffffffffffffffffff16815260200188888080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020018d8d8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020018b8b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020018281526020018660ff1681526020016001151581526020014281526020014281525060075f8681526020019081526020015f205f820151815f015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506020820151816001015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506040820151816002019081610e419190614342565b506060820151816003019081610e579190614457565b506080820151816004019081610e6d9190614457565b5060a0820151816005015560c0820151816006015f6101000a81548160ff021916908360ff16021790555060e08201518160060160016101000a81548160ff0219169083151502179055506101008201518160070155610120820151816008015590505060088054905060095f8681526020019081526020015f2081905550600884908060018154018082558091505060019003905f5260205f20015f9091909190915055600a5f3373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f2084908060018154018082558091505060019003905f5260205f20015f9091909190915055600b5f8660ff1660ff1681526020019081526020015f2084908060018154018082558091505060019003905f5260205f20015f90919091909150553373ffffffffffffffffffffffffffffffffffffffff16847f97d0af70a4d2c616e9c1093d5f57c8b31b3a7d824f1d335e5d5416402ec1493187604051610ff59190614526565b60405180910390a35050509a9950505050505050505050565b5f5f5f8381526020019081526020015f20600101549050919050565b6110338261100e565b61103c81612b74565b6110468383612b88565b50505050565b611054612c71565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146110b8576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6110c28282612c78565b505050565b7fae5084c516dacf3f1a818c437d702c28b8d2088455f592a7ea799413e3b6f1bf81565b6110f3612fbb565b5f60075f8481526020019081526020015f206007015403611140576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f8381526020019081526020015f20604051806101400160405290815f82015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001600182015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200160028201805461121690613f72565b80601f016020809104026020016040519081016040528092919081815260200182805461124290613f72565b801561128d5780601f106112645761010080835404028352916020019161128d565b820191905f5260205f20905b81548152906001019060200180831161127057829003601f168201915b505050505081526020016003820180546112a690613f72565b80601f01602080910402602001604051908101604052809291908181526020018280546112d290613f72565b801561131d5780601f106112f45761010080835404028352916020019161131d565b820191905f5260205f20905b81548152906001019060200180831161130057829003601f168201915b5050505050815260200160048201805461133690613f72565b80601f016020809104026020016040519081016040528092919081815260200182805461136290613f72565b80156113ad5780601f10611384576101008083540402835291602001916113ad565b820191905f5260205f20905b81548152906001019060200180831161139057829003601f168201915b5050505050815260200160058201548152602001600682015f9054906101000a900460ff1660ff1660ff1681526020016006820160019054906101000a900460ff16151515158152602001600782015481526020016008820154815250509050919050565b5f60075f8681526020019081526020015f2090505f816007015403611463576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060060160019054906101000a900460ff166114ab576040517fac10e00100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6114b881600501546126b9565b6114ee576040517f6c2ebf8000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b42841115611528576040517f0c57bc2c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6006548442611537919061456c565b111561156f576040517f39f8a70600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f85856040516020016115839291906145df565b6040516020818303038152906040528051906020012090505f61090073ffffffffffffffffffffffffffffffffffffffff16637e26679a846003018488886040518563ffffffff1660e01b81526004016115e0949392919061460a565b602060405180830381865afa1580156115fb573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061161f919061464f565b905080611658576040517f45576abb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b428360080181905550867f3cf0bf7708060bf073b6ddb921eef0485b3eb9da828e0ed751fa6582ef337f5787604051611691919061386b565b60405180910390a250505050505050565b5f5f1b6116ae81612b74565b8282600591826116bf929190614684565b5082826040516116d0929190613f01565b60405180910390207f378c4547bd8b346276ae1db9e298d984a43bd8788ad795e7a141ba069045f4cb60405160405180910390a2505050565b5f81805f0190611719919061475d565b838060200190611729919061475d565b858060400190611739919061475d565b60405160200161174e969594939291906147bf565b604051602081830303815290604052805190602001209050919050565b5f5f1b61177781612b74565b5f60015f8460ff1660ff1681526020019081526020015f2060020154036117ca576040517f04fcbec800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60015f8460ff1660ff1681526020019081526020015f206001015f6101000a81548160ff0219169083151502179055508160ff167f30e2b43b128fac88e776d92f693d539845d727cdb1978017ddff47a2e5319a0360405160405180910390a25050565b5f5f1b61183b81612b74565b816006819055505050565b5f60075f8381526020019081526020015f2060060160019054906101000a900460ff169050919050565b60065481565b5f5f1b61188281612b74565b5f60035f8481526020019081526020015f205f015f6101000a81548160ff021916908315150217905550817f021cbdaf8e2ddc626ca016468398743e833c1d67b00106b10077757586679a2060405160405180910390a26118e282612d61565b5050565b5f5f60075f8481526020019081526020015f206007015403611934576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f8381526020019081526020015f206001015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050919050565b5f5f5f8481526020019081526020015f205f015f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16905092915050565b6060806002805480602002602001604051908101604052809291908181526020018280548015611a4357602002820191905f5260205f20905f905b82829054906101000a900460ff1660ff16815260200190600101906020825f01049283019260010382029150808411611a0d5790505b5050505050915060028054905067ffffffffffffffff811115611a6957611a6861417e565b5b604051908082528060200260200182016040528015611aa257816020015b611a8f613038565b815260200190600190039081611a875790505b5090505f5f90505b600280549050811015611be85760015f60028381548110611ace57611acd6147f5565b5b905f5260205f2090602091828204019190069054906101000a900460ff1660ff1660ff1681526020019081526020015f206040518060600160405290815f82018054611b1990613f72565b80601f0160208091040260200160405190810160405280929190818152602001828054611b4590613f72565b8015611b905780601f10611b6757610100808354040283529160200191611b90565b820191905f5260205f20905b815481529060010190602001808311611b7357829003601f168201915b50505050508152602001600182015f9054906101000a900460ff16151515158152602001600282015481525050828281518110611bd057611bcf6147f5565b5b60200260200101819052508080600101915050611aaa565b509091565b5f5f1b81565b6003602052805f5260405f205f91509050805f015f9054906101000a900460ff1690806001015490806002015490806003018054611c3090613f72565b80601f0160208091040260200160405190810160405280929190818152602001828054611c5c90613f72565b8015611ca75780601f10611c7e57610100808354040283529160200191611ca7565b820191905f5260205f20905b815481529060010190602001808311611c8a57829003601f168201915b5050505050905084565b60605f60075f8481526020019081526020015f206007015403611d00576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f8381526020019081526020015f206003018054611d1f90613f72565b80601f0160208091040260200160405190810160405280929190818152602001828054611d4b90613f72565b8015611d965780601f10611d6d57610100808354040283529160200191611d96565b820191905f5260205f20905b815481529060010190602001808311611d7957829003601f168201915b50505050509050919050565b60605f60075f8481526020019081526020015f206007015403611df1576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60075f8381526020019081526020015f206004018054611e1090613f72565b80601f0160208091040260200160405190810160405280929190818152602001828054611e3c90613f72565b8015611e875780601f10611e5e57610100808354040283529160200191611e87565b820191905f5260205f20905b815481529060010190602001808311611e6a57829003601f168201915b50505050509050919050565b6060600b5f8360ff1660ff1681526020019081526020015f20805480602002602001604051908101604052809291908181526020018280548015611ef457602002820191905f5260205f20905b815481526020019060010190808311611ee0575b50505050509050919050565b5f5f1b611f0c81612b74565b5f611f1687611709565b90505f60035f8381526020019081526020015f206001015414611f65576040517f7ecd6d7100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f1b8414158015611f93575060035f8581526020019081526020015f205f015f9054906101000a900460ff165b15611fbd578242611fa49190614822565b60035f8681526020019081526020015f20600201819055505b60405180608001604052806001151581526020014281526020015f815260200187878080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081525060035f8381526020019081526020015f205f820151815f015f6101000a81548160ff0219169083151502179055506020820151816001015560408201518160020155606082015181600301908161207b9190614342565b50905050600481908060018154018082558091505060019003905f5260205f20015f909190919091505583817f7d0d48aca3f04e4d78b308b395437e0c9f7f64f3beda007017912dfc7d22186c8888876040516120da93929190614881565b60405180910390a350505050505050565b5f838383604051602001612101939291906148b1565b6040516020818303038152906040528051906020012090509392505050565b5f5f1b61212c81612b74565b5f60015f8660ff1660ff1681526020019081526020015f20600201541461217f576040517f095faf7300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604051806060016040528084848080601f0160208091040260200160405190810160405280939291908181526020018383808284375f81840152601f19601f8201169050808301925050505050505081526020016001151581526020014281525060015f8660ff1660ff1681526020019081526020015f205f820151815f01908161220a9190614342565b506020820151816001015f6101000a81548160ff02191690831515021790555060408201518160020155905050600284908060018154018082558091505060019003905f5260205f2090602091828204019190069091909190916101000a81548160ff021916908360ff1602179055508360ff167fed0161664cf318441e585cccad9fa9fc770298b648a49635dda84ac6f0adc90884846040516122af9291906148ed565b60405180910390a250505050565b6007602052805f5260405f205f91509050805f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690806001015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff169080600201805461232690613f72565b80601f016020809104026020016040519081016040528092919081815260200182805461235290613f72565b801561239d5780601f106123745761010080835404028352916020019161239d565b820191905f5260205f20905b81548152906001019060200180831161238057829003601f168201915b5050505050908060030180546123b290613f72565b80601f01602080910402602001604051908101604052809291908181526020018280546123de90613f72565b80156124295780601f1061240057610100808354040283529160200191612429565b820191905f5260205f20905b81548152906001019060200180831161240c57829003601f168201915b50505050509080600401805461243e90613f72565b80601f016020809104026020016040519081016040528092919081815260200182805461246a90613f72565b80156124b55780601f1061248c576101008083540402835291602001916124b5565b820191905f5260205f20905b81548152906001019060200180831161249857829003601f168201915b505050505090806005015490806006015f9054906101000a900460ff16908060060160019054906101000a900460ff1690806007015490806008015490508a565b6060600880548060200260200160405190810160405280929190818152602001828054801561254257602002820191905f5260205f20905b81548152602001906001019080831161252e575b5050505050905090565b60605f5f90505f5f90505b6004805490508110156125aa576125896004828154811061257b5761257a6147f5565b5b905f5260205f2001546126b9565b1561259d5781806125999061490f565b9250505b8080600101915050612557565b505f8167ffffffffffffffff8111156125c6576125c561417e565b5b6040519080825280602002602001820160405280156125f45781602001602082028036833780820191505090505b5090505f5f90505f5f90505b60048054905081101561268d5761263260048281548110612624576126236147f5565b5b905f5260205f2001546126b9565b15612680576004818154811061264b5761264a6147f5565b5b905f5260205f2001548383806126609061490f565b945081518110612673576126726147f5565b5b6020026020010181815250505b8080600101915050612600565b5081935050505090565b6126a08261100e565b6126a981612b74565b6126b38383612c78565b50505050565b5f5f60035f8481526020019081526020015f209050805f015f9054906101000a900460ff166126eb575f915050612717565b5f816002015414158015612703575080600201544210155b15612711575f915050612717565b60019150505b919050565b6001602052805f5260405f205f91509050805f01805461273b90613f72565b80601f016020809104026020016040519081016040528092919081815260200182805461276790613f72565b80156127b25780601f10612789576101008083540402835291602001916127b2565b820191905f5260205f20905b81548152906001019060200180831161279557829003601f168201915b505050505090806001015f9054906101000a900460ff16908060020154905083565b5f60075f8381526020019081526020015f2090505f816007015403612825576040517ff6523b6500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff16815f015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415801561288c575061288a5f5f1b3361196f565b155b156128c3576040517f98b31e6f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060060160019054906101000a900460ff166128df575061293c565b5f8160060160016101000a81548160ff02191690831515021790555042816008018190555061290d82612ea2565b817f784ce1077bc44f5b33e1724f6a1b9469423f16a15680c26d150787fb36349d1760405160405180910390a2505b50565b5f60015f8360ff1660ff1681526020019081526020015f206001015f9054906101000a900460ff169050919050565b6060600a5f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f208054806020026020016040519081016040528092919081815260200182805480156129f557602002820191905f5260205f20905b8154815260200190600101908083116129e1575b50505050509050919050565b5f5f1b612a0d81612b74565b612a1682612d61565b5050565b5f8282604051612a2b929190613f01565b6040518091039020905092915050565b60058054612a4890613f72565b80601f0160208091040260200160405190810160405280929190818152602001828054612a7490613f72565b8015612abf5780601f10612a9657610100808354040283529160200191612abf565b820191905f5260205f20905b815481529060010190602001808311612aa257829003601f168201915b505050505081565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b60088054905060095f8381526020019081526020015f2081905550600881908060018154018082558091505060019003905f5260205f20015f909190919091505550565b612b8581612b80612c71565b612f6a565b50565b5f612b93838361196f565b612c675760015f5f8581526020019081526020015f205f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550612c04612c71565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050612c6b565b5f90505b92915050565b5f33905090565b5f612c83838361196f565b15612d57575f5f5f8581526020019081526020015f205f015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550612cf4612c71565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a460019050612d5b565b5f90505b92915050565b5f5f90505f60088054905090505b5f811115612e5c575f6008600183612d87919061456c565b81548110612d9857612d976147f5565b5b905f5260205f20015490505f60075f8381526020019081526020015f209050848160050154148015612dd857508060060160019054906101000a900460ff165b15612e47575f8160060160016101000a81548160ff021916908315150217905550428160080181905550612e0b82612ea2565b817f784ce1077bc44f5b33e1724f6a1b9469423f16a15680c26d150787fb36349d1760405160405180910390a28380612e439061490f565b9450505b50508080612e5490614956565b915050612d6f565b505f811115612e9e57817f46830dc23f937ff33669b0270c90c655aea89fd176ba9f2275b67f329e3b8c9e82604051612e95919061386b565b60405180910390a25b5050565b5f60095f8381526020019081526020015f205490505f6001600880549050612eca919061456c565b9050808214612f2c575f60088281548110612ee857612ee76147f5565b5b905f5260205f20015490508060088481548110612f0857612f076147f5565b5b905f5260205f2001819055508260095f8381526020019081526020015f2081905550505b6008805480612f3e57612f3d61497d565b5b600190038181905f5260205f20015f9055905560095f8481526020019081526020015f205f9055505050565b612f74828261196f565b612fb75780826040517fe2517d3f000000000000000000000000000000000000000000000000000000008152600401612fae9291906149aa565b60405180910390fd5b5050565b6040518061014001604052805f73ffffffffffffffffffffffffffffffffffffffff1681526020015f73ffffffffffffffffffffffffffffffffffffffff1681526020016060815260200160608152602001606081526020015f81526020015f60ff1681526020015f151581526020015f81526020015f81525090565b6040518060600160405280606081526020015f151581526020015f81525090565b5f5ffd5b5f5ffd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61309581613061565b811461309f575f5ffd5b50565b5f813590506130b08161308c565b92915050565b5f602082840312156130cb576130ca613059565b5b5f6130d8848285016130a2565b91505092915050565b5f8115159050919050565b6130f5816130e1565b82525050565b5f60208201905061310e5f8301846130ec565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f61315661315161314c84613114565b613133565b613114565b9050919050565b5f6131678261313c565b9050919050565b5f6131788261315d565b9050919050565b6131888161316e565b82525050565b5f6020820190506131a15f83018461317f565b92915050565b5f819050919050565b6131b9816131a7565b81146131c3575f5ffd5b50565b5f813590506131d4816131b0565b92915050565b5f602082840312156131ef576131ee613059565b5b5f6131fc848285016131c6565b91505092915050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f83601f84011261322657613225613205565b5b8235905067ffffffffffffffff81111561324357613242613209565b5b60208301915083600182028301111561325f5761325e61320d565b5b9250929050565b5f61327082613114565b9050919050565b61328081613266565b811461328a575f5ffd5b50565b5f8135905061329b81613277565b92915050565b5f5f83601f8401126132b6576132b5613205565b5b8235905067ffffffffffffffff8111156132d3576132d2613209565b5b6020830191508360018202830111156132ef576132ee61320d565b5b9250929050565b5f60ff82169050919050565b61330b816132f6565b8114613315575f5ffd5b50565b5f8135905061332681613302565b92915050565b5f5f5f5f5f5f5f5f5f5f60c08b8d03121561334a57613349613059565b5b5f8b013567ffffffffffffffff8111156133675761336661305d565b5b6133738d828e01613211565b9a509a505060208b013567ffffffffffffffff8111156133965761339561305d565b5b6133a28d828e01613211565b985098505060408b013567ffffffffffffffff8111156133c5576133c461305d565b5b6133d18d828e01613211565b965096505060606133e48d828e0161328d565b94505060808b013567ffffffffffffffff8111156134055761340461305d565b5b6134118d828e016132a1565b935093505060a06134248d828e01613318565b9150509295989b9194979a5092959850565b61343f816131a7565b82525050565b5f6020820190506134585f830184613436565b92915050565b5f5f6040838503121561347457613473613059565b5b5f613481858286016131c6565b92505060206134928582860161328d565b9150509250929050565b6134a581613266565b82525050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6134ed826134ab565b6134f781856134b5565b93506135078185602086016134c5565b613510816134d3565b840191505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f61353f8261351b565b6135498185613525565b93506135598185602086016134c5565b613562816134d3565b840191505092915050565b613576816131a7565b82525050565b613585816132f6565b82525050565b613594816130e1565b82525050565b5f819050919050565b6135ac8161359a565b82525050565b5f61014083015f8301516135c85f86018261349c565b5060208301516135db602086018261349c565b50604083015184820360408601526135f382826134e3565b9150506060830151848203606086015261360d8282613535565b915050608083015184820360808601526136278282613535565b91505060a083015161363c60a086018261356d565b5060c083015161364f60c086018261357c565b5060e083015161366260e086018261358b565b506101008301516136776101008601826135a3565b5061012083015161368c6101208601826135a3565b508091505092915050565b5f6020820190508181035f8301526136af81846135b2565b905092915050565b6136c08161359a565b81146136ca575f5ffd5b50565b5f813590506136db816136b7565b92915050565b5f5f5f5f606085870312156136f9576136f8613059565b5b5f613706878288016131c6565b9450506020613717878288016136cd565b935050604085013567ffffffffffffffff8111156137385761373761305d565b5b61374487828801613211565b925092505092959194509250565b5f5f6020838503121561376857613767613059565b5b5f83013567ffffffffffffffff8111156137855761378461305d565b5b61379185828601613211565b92509250509250929050565b5f5ffd5b5f606082840312156137b6576137b561379d565b5b81905092915050565b5f602082840312156137d4576137d3613059565b5b5f82013567ffffffffffffffff8111156137f1576137f061305d565b5b6137fd848285016137a1565b91505092915050565b5f6020828403121561381b5761381a613059565b5b5f61382884828501613318565b91505092915050565b5f6020828403121561384657613845613059565b5b5f613853848285016136cd565b91505092915050565b6138658161359a565b82525050565b5f60208201905061387e5f83018461385c565b92915050565b61388d81613266565b82525050565b5f6020820190506138a65f830184613884565b92915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f6138e0838361357c565b60208301905092915050565b5f602082019050919050565b5f613902826138ac565b61390c81856138b6565b9350613917836138c6565b805f5b8381101561394757815161392e88826138d5565b9750613939836138ec565b92505060018101905061391a565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f606083015f8301518482035f86015261399782826134e3565b91505060208301516139ac602086018261358b565b5060408301516139bf60408601826135a3565b508091505092915050565b5f6139d5838361397d565b905092915050565b5f602082019050919050565b5f6139f382613954565b6139fd818561395e565b935083602082028501613a0f8561396e565b805f5b85811015613a4a5784840389528151613a2b85826139ca565b9450613a36836139dd565b925060208a01995050600181019050613a12565b50829750879550505050505092915050565b5f6040820190508181035f830152613a7481856138f8565b90508181036020830152613a8881846139e9565b90509392505050565b5f82825260208201905092915050565b5f613aab826134ab565b613ab58185613a91565b9350613ac58185602086016134c5565b613ace816134d3565b840191505092915050565b5f608082019050613aec5f8301876130ec565b613af9602083018661385c565b613b06604083018561385c565b8181036060830152613b188184613aa1565b905095945050505050565b5f82825260208201905092915050565b5f613b3d8261351b565b613b478185613b23565b9350613b578185602086016134c5565b613b60816134d3565b840191505092915050565b5f6020820190508181035f830152613b838184613b33565b905092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b5f613bbf838361356d565b60208301905092915050565b5f602082019050919050565b5f613be182613b8b565b613beb8185613b95565b9350613bf683613ba5565b805f5b83811015613c26578151613c0d8882613bb4565b9750613c1883613bcb565b925050600181019050613bf9565b5085935050505092915050565b5f6020820190508181035f830152613c4b8184613bd7565b905092915050565b5f5f5f5f5f60808688031215613c6c57613c6b613059565b5b5f86013567ffffffffffffffff811115613c8957613c8861305d565b5b613c95888289016137a1565b955050602086013567ffffffffffffffff811115613cb657613cb561305d565b5b613cc2888289016132a1565b94509450506040613cd5888289016131c6565b9250506060613ce6888289016136cd565b9150509295509295909350565b5f5f5f60608486031215613d0a57613d09613059565b5b5f613d17868287016131c6565b9350506020613d28868287016131c6565b9250506040613d39868287016136cd565b9150509250925092565b5f5f5f60408486031215613d5a57613d59613059565b5b5f613d6786828701613318565b935050602084013567ffffffffffffffff811115613d8857613d8761305d565b5b613d94868287016132a1565b92509250509250925092565b613da9816132f6565b82525050565b5f61014082019050613dc35f83018d613884565b613dd0602083018c613884565b8181036040830152613de2818b613aa1565b90508181036060830152613df6818a613b33565b90508181036080830152613e0a8189613b33565b9050613e1960a0830188613436565b613e2660c0830187613da0565b613e3360e08301866130ec565b613e4161010083018561385c565b613e4f61012083018461385c565b9b9a5050505050505050505050565b5f6060820190508181035f830152613e768186613aa1565b9050613e8560208301856130ec565b613e92604083018461385c565b949350505050565b5f60208284031215613eaf57613eae613059565b5b5f613ebc8482850161328d565b91505092915050565b5f81905092915050565b828183375f83830152505050565b5f613ee88385613ec5565b9350613ef5838584613ecf565b82840190509392505050565b5f613f0d828486613edd565b91508190509392505050565b5f613f248385613b23565b9350613f31838584613ecf565b613f3a836134d3565b840190509392505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602260045260245ffd5b5f6002820490506001821680613f8957607f821691505b602082108103613f9c57613f9b613f45565b5b50919050565b5f819050815f5260205f209050919050565b5f8154613fc081613f72565b613fca8186613b23565b9450600182165f8114613fe45760018114613ffa5761402c565b60ff19831686528115156020028601935061402c565b61400385613fa2565b5f5b8381101561402457815481890152600182019150602081019050614005565b808801955050505b50505092915050565b5f6080820190508181035f83015261404e81898b613f19565b90508181036020830152614063818789613f19565b90508181036040830152614078818587613f19565b9050818103606083015261408c8184613fb4565b905098975050505050505050565b6140a3816130e1565b81146140ad575f5ffd5b50565b5f815190506140be8161409a565b92915050565b5f815190506140d2816131b0565b92915050565b5f5f604083850312156140ee576140ed613059565b5b5f6140fb858286016140b0565b925050602061410c858286016140c4565b9150509250929050565b7f4174746573746174696f6e20766572696669636174696f6e206661696c6564005f82015250565b5f61414a601f83613a91565b915061415582614116565b602082019050919050565b5f6020820190508181035f8301526141778161413e565b9050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b5f819050815f5260205f209050919050565b5f6020601f8301049050919050565b5f82821b905092915050565b5f600883026142077fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff826141cc565b61421186836141cc565b95508019841693508086168417925050509392505050565b5f61424361423e6142398461359a565b613133565b61359a565b9050919050565b5f819050919050565b61425c83614229565b6142706142688261424a565b8484546141d8565b825550505050565b5f5f905090565b614287614278565b614292818484614253565b505050565b5b818110156142b5576142aa5f8261427f565b600181019050614298565b5050565b601f8211156142fa576142cb816141ab565b6142d4846141bd565b810160208510156142e3578190505b6142f76142ef856141bd565b830182614297565b50505b505050565b5f82821c905092915050565b5f61431a5f19846008026142ff565b1980831691505092915050565b5f614332838361430b565b9150826002028217905092915050565b61434b826134ab565b67ffffffffffffffff8111156143645761436361417e565b5b61436e8254613f72565b6143798282856142b9565b5f60209050601f8311600181146143aa575f8415614398578287015190505b6143a28582614327565b865550614409565b601f1984166143b8866141ab565b5f5b828110156143df578489015182556001820191506020850194506020810190506143ba565b868310156143fc57848901516143f8601f89168261430b565b8355505b6001600288020188555050505b505050505050565b601f8211156144525761442381613fa2565b61442c846141bd565b8101602085101561443b578190505b61444f614447856141bd565b830182614297565b50505b505050565b6144608261351b565b67ffffffffffffffff8111156144795761447861417e565b5b6144838254613f72565b61448e828285614411565b5f60209050601f8311600181146144bf575f84156144ad578287015190505b6144b78582614327565b86555061451e565b601f1984166144cd86613fa2565b5f5b828110156144f4578489015182556001820191506020850194506020810190506144cf565b86831015614511578489015161450d601f89168261430b565b8355505b6001600288020188555050505b505050505050565b5f6020820190506145395f830184613da0565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6145768261359a565b91506145818361359a565b92508282039050818111156145995761459861453f565b5b92915050565b5f819050919050565b6145b96145b4826131a7565b61459f565b82525050565b5f819050919050565b6145d96145d48261359a565b6145bf565b82525050565b5f6145ea82856145a8565b6020820191506145fa82846145c8565b6020820191508190509392505050565b5f6060820190508181035f8301526146228187613fb4565b90506146316020830186613436565b8181036040830152614644818486613f19565b905095945050505050565b5f6020828403121561466457614663613059565b5b5f614671848285016140b0565b91505092915050565b5f82905092915050565b61468e838361467a565b67ffffffffffffffff8111156146a7576146a661417e565b5b6146b18254613f72565b6146bc828285614411565b5f601f8311600181146146e9575f84156146d7578287013590505b6146e18582614327565b865550614748565b601f1984166146f786613fa2565b5f5b8281101561471e578489013582556001820191506020850194506020810190506146f9565b8683101561473b5784890135614737601f89168261430b565b8355505b6001600288020188555050505b50505050505050565b5f5ffd5b5f5ffd5b5f5ffd5b5f5f8335600160200384360303811261477957614778614751565b5b80840192508235915067ffffffffffffffff82111561479b5761479a614755565b5b6020830192506001820236038313156147b7576147b6614759565b5b509250929050565b5f6147cb82888a613edd565b91506147d8828688613edd565b91506147e5828486613edd565b9150819050979650505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f61482c8261359a565b91506148378361359a565b925082820190508082111561484f5761484e61453f565b5b92915050565b5f6148608385613a91565b935061486d838584613ecf565b614876836134d3565b840190509392505050565b5f6040820190508181035f83015261489a818587614855565b90506148a9602083018461385c565b949350505050565b5f6148bc82866145a8565b6020820191506148cc82856145a8565b6020820191506148dc82846145c8565b602082019150819050949350505050565b5f6020820190508181035f830152614906818486614855565b90509392505050565b5f6149198261359a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361494b5761494a61453f565b5b600182019050919050565b5f6149608261359a565b91505f82036149725761497161453f565b5b600182039050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603160045260245ffd5b5f6040820190506149bd5f830185613884565b6149ca6020830184613436565b939250505056fea26469706673582212201567f158f5e99bc78a5379f9de16126e3c6ee87955f8bc5a5d3d5eca524ae37964736f6c634300081c0033" +const TEE_REGISTRY_BYTECODE = "" // ============================================================================ // AccessControl Role Constants @@ -1494,3 +1495,10 @@ func extractPCRsFromAttestation(attestationBytes []byte) (map[int][]byte, error) return doc.PCRs, nil } + +func getEnvOrDefault(key, defaultValue string) string { + if value := os.Getenv(key); value != "" { + return value + } + return defaultValue +} \ No newline at end of file diff --git a/scripts/tee-mgmt-cli/.env.example b/scripts/tee-mgmt-cli/.env.example index 70a680ab..17b48175 100644 --- a/scripts/tee-mgmt-cli/.env.example +++ b/scripts/tee-mgmt-cli/.env.example @@ -6,7 +6,7 @@ # ============================================================================= # RPC endpoint for the OpenGradient network -RPC_URL=http://13.59.43.94:8545 +RPC_URL=http://127.0.0.1:8545 # TEE Registry contract address TEE_REGISTRY_ADDRESS=0x3d641a2791533b4a0000345ea8d509d01e1ec301 From 1fbda1621c5d43937fee9295442f4783accab8bb Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Tue, 10 Mar 2026 18:32:20 +0100 Subject: [PATCH 02/12] reslove precompile contract issue --- contracts/hardhat.config.js | 1 + contracts/package.json | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/contracts/hardhat.config.js b/contracts/hardhat.config.js index 7be09191..88d5e90a 100644 --- a/contracts/hardhat.config.js +++ b/contracts/hardhat.config.js @@ -20,5 +20,6 @@ export default { }, paths: { sources: "./solidity", + exclude: ["**/lib/**"] }, }; diff --git a/contracts/package.json b/contracts/package.json index 7b9c584c..d49eca81 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -3,7 +3,7 @@ "version": "2.0.0", "description": "A collection of smart contracts used in the development of the Cosmos EVM blockchain.", "devDependencies": { - "@openzeppelin/contracts": "^5.4.0", + "@openzeppelin/contracts": "4.9.6", "hardhat": "^3.0.15" }, "scripts": { From 7e467c54329636d730b055e8a82978d0f8058d2c Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Wed, 11 Mar 2026 13:45:06 +0100 Subject: [PATCH 03/12] provide registration steps --- scripts/tee-mgmt-cli/Registration.md | 205 +++++++++++++++++++++++++++ 1 file changed, 205 insertions(+) create mode 100644 scripts/tee-mgmt-cli/Registration.md diff --git a/scripts/tee-mgmt-cli/Registration.md b/scripts/tee-mgmt-cli/Registration.md new file mode 100644 index 00000000..c919880f --- /dev/null +++ b/scripts/tee-mgmt-cli/Registration.md @@ -0,0 +1,205 @@ +# How to Register a New TEE + +This guide walks through the complete process of registering a Trusted Execution Environment (TEE) on the OpenGradient network. + +## Overview + +TEE registration establishes a hardware-rooted chain of trust: +1. **AWS Nitro Hardware** signs an attestation document +2. **Precompile verifies** attestation against AWS root certificate +3. **Contract validates** PCR measurements match approved enclave code +4. **Keys are bound** — signing key & TLS cert cryptographically tied to verified enclave +5. **TEE registered** — now ready to serve verified AI inference requests + +## Prerequisites + +### 1. Access & Permissions + +- **RPC endpoint** to OpenGradient network +- **Funded account** with gas for transactions +- **TEE_OPERATOR role** (granted by admin) to register TEEs +- **Registry address** of the deployed TEERegistry contract + +### 2. Running Enclave + +- **AWS Nitro Enclave** running approved code +- Accessible at `:443` with HTTPS endpoints: + - `GET /enclave/attestation?nonce=<40-char-hex>` — returns base64 attestation document + - `GET /signing-key` — returns JSON with signing public key PEM + - TLS endpoint exposing certificate at `:443` + +### 3. PCR Measurements + +- **measurements.txt** file with PCR0, PCR1, PCR2 values from your enclave build +- Format: +```json + { + "Measurements": { + "PCR0": "8c7b728e1a8e034aa1cc6c82521adeacec05118b766d5203c80aaf84322b73d095e05672d98fba613ba2b3aaa0e6a482", + "PCR1": "4b4d5b3661b3efc12920900c80e126e4ce783c522de6c02a2a5bf7af3a2b9327b86776f188e4be1c1c404a129dbda493", + "PCR2": "74787f27d0c4bbead44d7a61a02df3b8297b0ab1faffb8ebd113a34b434147acb7cd21504b82eeea34100034ccaaed94" + } + } +``` + +## Step-by-Step Registration + +### Step 1: Configure CLI +```bash +# Option A: Use .env file +cp .env.example .env +``` + +Edit `.env`: +```bash +RPC_URL=https://ogevmdevnet.opengradient.ai +TEE_REGISTRY_ADDRESS=0x4e72238852f3c918f4E4e57AeC9280dDB0c80248 +TEE_PRIVATE_KEY=your_private_key_here # Account with TEE_OPERATOR role +``` +```bash +### Step 2: One-Time Admin Setup (Skip if you are using our mainnet) + +These steps only need to be performed once by an admin: +```bash +# Add TEE type (type 0 = LLMProxy) +./tee-cli type add 0 LLMProxy + +# Set AWS Nitro root certificate (validates attestation documents) +./tee-cli cert set-aws aws_nitro_root.pem + +# Approve your enclave's PCR measurements +./tee-cli pcr approve \ + -m measurements.txt \ + -v "v1.0.0" \ + --tee-type 0 +``` + +Verify PCR is approved: +```bash +# Compute the PCR hash first +./tee-cli pcr compute -m measurements.txt +# Output: PCR Hash: 0x77786f3515030fe50a260c26d229eff15d2db0e211008f1581dc3e91bfd25703 + +# Check approval status +./tee-cli pcr check 0x77786f3515030fe50a260c26d229eff15d2db0e211008f1581dc3e91bfd25703 +``` + +### Step 3: Register Your TEE +```bash +./tee-cli tee register +``` + +**What happens during registration:** + +1. ✅ CLI generates a random 20-byte nonce +2. ✅ Fetches attestation document from `https://enclave_host/enclave/attestation?nonce=` +3. ✅ Fetches signing public key from `https://enclave_host/signing-key` +4. ✅ Fetches TLS certificate via TLS handshake to `enclave_host:443` +5. ✅ Computes expected TEE ID: `keccak256(signing_public_key)` +6. ✅ Submits transaction: `registerTEEWithAttestation(attestation, signingKey, tlsCert, paymentAddr, endpoint, teeType)` +7. ✅ Contract verifies attestation via precompile (checks AWS signature, PCR approval) +8. ✅ TEE is registered and **enabled** by default + +### Step 4: Verify Registration +```bash +# List all enabled TEEs +./tee-cli tee list + +# Show your TEE details +./tee-cli tee show 0xe10366dfcd1a40e97042fbd7b422cd9033921291d0d1b7f40a2a15fc748ae711 +``` + +Expected output: +``` +=== TEE Details: 0xe10366dfcd1a40e97042fbd7b422cd9033921291d0d1b7f40a2a15fc748ae711 === + Owner: 0x24E4BEa7164BCFb52CCAe10EdE4f5a0cB9F09C4b + Payment Addr: 0x24E4BEa7164BCFb52CCAe10EdE4f5a0cB9F09C4b + Endpoint: https://3.15.214.21 + PCR Hash: 0x77786f3515030fe50a260c26d229eff15d2db0e211008f1581dc3e91bfd25703 + TEE Type: 0 (LLMProxy) + Enabled: true + Registered: 2026-03-11 10:36:37 UTC + Last Heartbeat: 2026-03-11 10:36:37 UTC +``` + +## Lifecycle Management +```bash +# Temporarily disable a TEE (can be re-enabled) +./tee-cli tee deactivate 0xe10366dfcd1a40e97042fbd7b422cd9033921291d0d1b7f40a2a15fc748ae711 + +# Re-enable a disabled TEE (validates PCR is still approved) +./tee-cli tee activate 0xe10366dfcd1a40e97042fbd7b422cd9033921291d0d1b7f40a2a15fc748ae711 +``` + +## Common Issues + +### "PCR not approved" +**Cause:** Your enclave's PCR measurements haven't been approved by an admin. + +**Solution:** +```bash +# Check which PCRs are approved +./tee-cli pcr list + +# Admin must approve your PCR +./tee-cli pcr approve -m measurements.txt -v "v1.0.0" --tee-type 0 +``` + +### "Attestation verification failed" +**Causes:** +- AWS root certificate not set in contract +- Attestation document expired or invalid +- Enclave not running approved code + +**Solutions:** +```bash +# Verify AWS cert is set +./tee-cli cert set-aws aws_nitro_root.pem + +# Check enclave is accessible +curl -k https://enclave_host/enclave/attestation?nonce=abc123... + +# Verify PCR values match approved measurements +./tee-cli pcr compute -m measurements.txt +``` + +### "Key not found" or "insufficient funds" +**Cause:** Account doesn't have TEE_OPERATOR role or gas funds. + +**Solution:** +```bash +# Check role +./tee-cli role check operator account_address + +# Admin grants role +./tee-cli role grant-operator account_address + +# Fund account (transfer from funded account) +``` + +### "TEE already exists" +**Cause:** A TEE with the same signing public key is already registered. + +**Solution:** +- Each enclave instance has a unique signing key bound at boot +- If you restarted the enclave, it will have a new key → new TEE ID +- If the old TEE ID exists, disable it first: +```bash + ./tee-cli tee deactivate +``` + +## Quick Reference +```bash +# Complete registration flow (assuming admin setup done) +./tee-cli tee register --enclave-host 3.15.214.21 --tee-type 0 +./tee-cli tee list +./tee-cli tee show + +# Disable/re-enable +./tee-cli tee deactivate +./tee-cli tee activate + +# Check PCR approval +./tee-cli pcr compute -m measurements.txt +./tee-cli pcr check +``` From 00f847429f6647c2747c877b75a7c9206d7c6f3a Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Thu, 12 Mar 2026 10:43:46 +0100 Subject: [PATCH 04/12] refactor: rename binary from evmd to ogd - Rename main binary from evmd to ogd throughout codebase - Update CLI command references in all shell scripts - Change home directory from .evmd to .ogd - Update Docker container names and image references - Rename script directory: tests/jsonrpc/scripts/evmd -> ogd - Rename script files: start-evmd.sh, stop-evmd.sh, container-start-evmd.sh - Update import path: evmd/cmd/evmd/cmd -> evmd/cmd/ogd/cmd --- Makefile | 16 ++--- evmd/cmd/{evmd => ogd}/cmd/creator.go | 0 evmd/cmd/{evmd => ogd}/cmd/root.go | 2 +- evmd/cmd/{evmd => ogd}/cmd/testnet.go | 8 +-- evmd/cmd/{evmd => ogd}/cmd/testnet_test.go | 0 evmd/cmd/{evmd => ogd}/cmd/testnet_utils.go | 0 .../{evmd => ogd}/cmd/testnet_utils_test.go | 0 evmd/cmd/{evmd => ogd}/main.go | 4 +- local_node.sh | 32 +++++----- multi_node_startup.sh | 32 +++++----- .../container-start-ogd.sh} | 48 +++++++------- .../{evmd/start-evmd.sh => ogd/start-ogd.sh} | 62 +++++++++---------- .../{evmd/stop-evmd.sh => ogd/stop-ogd.sh} | 8 +-- tests/jsonrpc/scripts/run-compat-test.sh | 24 +++---- tests/jsonrpc/scripts/start-networks.sh | 14 ++--- tests/jsonrpc/scripts/stop-networks.sh | 10 +-- 16 files changed, 130 insertions(+), 130 deletions(-) rename evmd/cmd/{evmd => ogd}/cmd/creator.go (100%) rename evmd/cmd/{evmd => ogd}/cmd/root.go (99%) rename evmd/cmd/{evmd => ogd}/cmd/testnet.go (98%) rename evmd/cmd/{evmd => ogd}/cmd/testnet_test.go (100%) rename evmd/cmd/{evmd => ogd}/cmd/testnet_utils.go (100%) rename evmd/cmd/{evmd => ogd}/cmd/testnet_utils_test.go (100%) rename evmd/cmd/{evmd => ogd}/main.go (74%) rename tests/jsonrpc/scripts/{evmd/container-start-evmd.sh => ogd/container-start-ogd.sh} (58%) rename tests/jsonrpc/scripts/{evmd/start-evmd.sh => ogd/start-ogd.sh} (81%) rename tests/jsonrpc/scripts/{evmd/stop-evmd.sh => ogd/stop-ogd.sh} (67%) diff --git a/Makefile b/Makefile index 367e7ffe..6813dbba 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ COMMIT := $(shell git log -1 --format='%H') BINDIR ?= $(GOPATH)/bin BUILDDIR ?= $(CURDIR)/build -EXAMPLE_BINARY := evmd +EXAMPLE_BINARY := ogd ############################################################################### ### Repo Info ### @@ -31,10 +31,10 @@ export GO111MODULE = on # evmd is a separate module under ./evmd EVMD_DIR := evmd -EVMD_MAIN_PKG := ./cmd/evmd +EVMD_MAIN_PKG := ./cmd/ogd ############################################################################### -### Build & Install evmd ### +### Build & Install ogd ### ############################################################################### # process build tags @@ -96,7 +96,7 @@ endif # Build into $(BUILDDIR) build: go.sum $(BUILDDIR)/ - @echo "🏗️ Building evmd to $(BUILDDIR)/$(EXAMPLE_BINARY) ..." + @echo "🏗️ Building ogd to $(BUILDDIR)/$(EXAMPLE_BINARY) ..." @echo "BUILD_FLAGS: $(BUILD_FLAGS)" @cd $(EVMD_DIR) && CGO_ENABLED="1" \ go build $(BUILD_FLAGS) -o $(BUILDDIR)/$(EXAMPLE_BINARY) $(EVMD_MAIN_PKG) @@ -107,7 +107,7 @@ build-linux: # Install into $(BINDIR) install: go.sum - @echo "🚚 Installing evmd to $(BINDIR) ..." + @echo "🚚 Installing ogd to $(BINDIR) ..." @echo "BUILD_FLAGS: $(BUILD_FLAGS)" @cd $(EVMD_DIR) && CGO_ENABLED="1" \ go install $(BUILD_FLAGS) $(EVMD_MAIN_PKG) @@ -387,7 +387,7 @@ test-rpc-compat-stop: test-system: build-v05 build mkdir -p ./tests/systemtests/binaries/ - cp $(BUILDDIR)/evmd ./tests/systemtests/binaries/ + cp $(BUILDDIR)/$(EXAMPLE_BINARY) ./tests/systemtests/binaries/ cd tests/systemtests/Counter && forge build $(MAKE) -C tests/systemtests test @@ -395,7 +395,7 @@ build-v05: mkdir -p ./tests/systemtests/binaries/v0.5 git checkout v0.5.0 make build - cp $(BUILDDIR)/evmd ./tests/systemtests/binaries/v0.5 + cp $(BUILDDIR)/$(EXAMPLE_BINARY) ./tests/systemtests/binaries/v0.5 git checkout - mocks: @@ -472,4 +472,4 @@ d2gen-all: d2check printf "📊 generating $$svgfile from $$d2file... "; \ $(D2_ENV_VARS) d2 "$$d2file" "$$svgfile" > /dev/null 2>&1 && echo "done ✅" || echo "failed ❌"; \ done - @echo "✅ svg files generated for all d2 diagrams" + @echo "✅ svg files generated for all d2 diagrams" \ No newline at end of file diff --git a/evmd/cmd/evmd/cmd/creator.go b/evmd/cmd/ogd/cmd/creator.go similarity index 100% rename from evmd/cmd/evmd/cmd/creator.go rename to evmd/cmd/ogd/cmd/creator.go diff --git a/evmd/cmd/evmd/cmd/root.go b/evmd/cmd/ogd/cmd/root.go similarity index 99% rename from evmd/cmd/evmd/cmd/root.go rename to evmd/cmd/ogd/cmd/root.go index b3dd8943..3bcbdc65 100644 --- a/evmd/cmd/evmd/cmd/root.go +++ b/evmd/cmd/ogd/cmd/root.go @@ -86,7 +86,7 @@ func NewRootCmd() *cobra.Command { WithLedgerHasProtobuf(true) rootCmd := &cobra.Command{ - Use: "evmd", + Use: "ogd", Short: "exemplary Cosmos EVM app", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs diff --git a/evmd/cmd/evmd/cmd/testnet.go b/evmd/cmd/ogd/cmd/testnet.go similarity index 98% rename from evmd/cmd/evmd/cmd/testnet.go rename to evmd/cmd/ogd/cmd/testnet.go index fcec7b97..3768e37f 100644 --- a/evmd/cmd/evmd/cmd/testnet.go +++ b/evmd/cmd/ogd/cmd/testnet.go @@ -170,7 +170,7 @@ or a similar setup where each node has a manually configurable IP address. Note, strict routability for addresses is turned off in the config file. Example: - evmd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 + ogd testnet init-files --v 4 --output-dir ./.testnets --starting-ip-address 192.168.10.2 `, RunE: func(cmd *cobra.Command, _ []string) error { clientCtx, err := client.GetClientQueryContext(cmd) @@ -215,7 +215,7 @@ Example: cmd.Flags().Duration(flagCommitTimeout, 5*time.Second, "Time to wait after a block commit before starting on the new height") cmd.Flags().Bool(flagSingleHost, false, "Cluster runs on a single host machine with different ports") cmd.Flags().String(flagNodeDirPrefix, "node", "Prefix the directory name for each node with (node results in node0, node1, ...)") - cmd.Flags().String(flagNodeDaemonHome, "evmd", "Home directory of the node's daemon configuration") + cmd.Flags().String(flagNodeDaemonHome, "ogd", "Home directory of the node's daemon configuration") cmd.Flags().String(flagStartingIPAddress, "192.168.0.1", "Starting IP address (192.168.0.1 results in persistent peers list ID0@192.168.0.1:46656, ID1@192.168.0.2:46656, ...)") cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|test)") cmd.Flags().Bool(flagsUseDocker, false, "test network via docker") @@ -234,7 +234,7 @@ and generate "v" directories, populated with necessary validator configuration f (private validator, genesis, config, etc.). Example: - evmd testnet --v 4 --output-dir ./.testnets + ogd testnet --v 4 --output-dir ./.testnets `, RunE: func(cmd *cobra.Command, _ []string) error { args := startArgs{} @@ -748,7 +748,7 @@ func startTestnet(cmd *cobra.Command, args startArgs) error { return nil } -// NewTestNetworkFixture returns a new evmd AppConstructor for network simulation tests +// NewTestNetworkFixture returns a new ogd AppConstructor for network simulation tests func NewTestNetworkFixture() sdknetwork.TestFixture { dir, err := os.MkdirTemp("", "evm") if err != nil { diff --git a/evmd/cmd/evmd/cmd/testnet_test.go b/evmd/cmd/ogd/cmd/testnet_test.go similarity index 100% rename from evmd/cmd/evmd/cmd/testnet_test.go rename to evmd/cmd/ogd/cmd/testnet_test.go diff --git a/evmd/cmd/evmd/cmd/testnet_utils.go b/evmd/cmd/ogd/cmd/testnet_utils.go similarity index 100% rename from evmd/cmd/evmd/cmd/testnet_utils.go rename to evmd/cmd/ogd/cmd/testnet_utils.go diff --git a/evmd/cmd/evmd/cmd/testnet_utils_test.go b/evmd/cmd/ogd/cmd/testnet_utils_test.go similarity index 100% rename from evmd/cmd/evmd/cmd/testnet_utils_test.go rename to evmd/cmd/ogd/cmd/testnet_utils_test.go diff --git a/evmd/cmd/evmd/main.go b/evmd/cmd/ogd/main.go similarity index 74% rename from evmd/cmd/evmd/main.go rename to evmd/cmd/ogd/main.go index 2a5d62fa..94825bc8 100644 --- a/evmd/cmd/evmd/main.go +++ b/evmd/cmd/ogd/main.go @@ -6,7 +6,7 @@ import ( svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/evm/evmd/cmd/evmd/cmd" + "github.com/cosmos/evm/evmd/cmd/ogd/cmd" "github.com/cosmos/evm/evmd/config" ) @@ -14,7 +14,7 @@ func main() { setupSDKConfig() rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "evmd", config.MustGetDefaultNodeHome()); err != nil { + if err := svrcmd.Execute(rootCmd, "ogd", config.MustGetDefaultNodeHome()); err != nil { fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) } diff --git a/local_node.sh b/local_node.sh index 1f4d4c32..cb8a2d4d 100755 --- a/local_node.sh +++ b/local_node.sh @@ -9,7 +9,7 @@ KEYRING="test" KEYALGO="eth_secp256k1" LOGLEVEL="info" -# Set dedicated home directory for the evmd instance +# Set dedicated home directory for the ogd instance CHAINDIR="$HOME/.og-evm-devnet" BASEFEE=10000000 @@ -47,7 +47,7 @@ Options: --no-install Skip 'make install' --remote-debugging Build with nooptimization,nostrip --additional-users N Create N extra users: dev4, dev5, ... - --mnemonic-file PATH Where to write mnemonics YAML (default: \$HOME/.evmd/mnemonics.yaml) + --mnemonic-file PATH Where to write mnemonics YAML (default: \$HOME/.ogd/mnemonics.yaml) --mnemonics-input PATH Read dev mnemonics from a yaml file (key: mnemonics:) EOF } @@ -64,7 +64,7 @@ while [[ $# -gt 0 ]]; do overwrite="n"; shift ;; --no-install) - echo "Flag --no-install passed -> Skipping installation of the evmd binary." + echo "Flag --no-install passed -> Skipping installation of the ogd binary." install=false; shift ;; --remote-debugging) @@ -164,20 +164,20 @@ write_mnemonics_yaml() { # ---------- Add funded account ---------- add_genesis_funds() { local keyname="$1" - evmd genesis add-genesis-account "$keyname" 10000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd genesis add-genesis-account "$keyname" 10000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" } # Setup local node if overwrite is set to Yes, otherwise skip setup if [[ $overwrite == "y" || $overwrite == "Y" ]]; then rm -rf "$CHAINDIR" - evmd config set client chain-id "$CHAINID" --home "$CHAINDIR" - evmd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd config set client chain-id "$CHAINID" --home "$CHAINDIR" + ogd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" # ---------------- Validator key ---------------- VAL_KEY="mykey" VAL_MNEMONIC="gesture inject test cycle original hollow east ridge hen combine junk child bacon zero hope comfort vacuum milk pitch cage oppose unhappy lunar seat" - echo "$VAL_MNEMONIC" | evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" + echo "$VAL_MNEMONIC" | ogd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" # ---------------- dev mnemonics source ---------------- # dev0 address 0xC6Fe5D33615a1C52c08018c47E8Bc53646A0E101 | og1cml96vmptgw99syqrrz8az79xer2pcgpum8mp7 @@ -228,7 +228,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then fi # init chain w/ validator mnemonic - echo "$VAL_MNEMONIC" | evmd init $MONIKER -o --chain-id "$CHAINID" --home "$CHAINDIR" --recover + echo "$VAL_MNEMONIC" | ogd init $MONIKER -o --chain-id "$CHAINID" --home "$CHAINDIR" --recover # ---------- Genesis customizations ---------- jq '.app_state["staking"]["params"]["bond_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -238,7 +238,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["evm"]["params"]["evm_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OPG","exponent":18,"aliases":[]}],"base":"ogwei","display":"OPG","name":"OpenGradient Token","symbol":"OPG","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for ogd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OPG","exponent":18,"aliases":[]}],"base":"ogwei","display":"OPG","name":"OpenGradient Token","symbol":"OPG","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805", "0x0000000000000000000000000000000000000806", "0x0000000000000000000000000000000000000807", "0x0000000000000000000000000000000000000900"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["evm"]["params"]["evm_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -254,7 +254,7 @@ jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x000000000000000 sed -i.bak 's/"expedited_voting_period": "86400s"/"expedited_voting_period": "15s"/g' "$GENESIS" # fund validator (devs already funded in the loop) - evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" # ---------- Config customizations ---------- sed -i.bak 's/timeout_propose = "3s"/timeout_propose = "2s"/g' "$CONFIG_TOML" @@ -291,7 +291,7 @@ jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x000000000000000 echo "adding key for $keyname" # Add key to keyring using the mnemonic - echo "$mnemonic" | evmd keys add "$keyname" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" + echo "$mnemonic" | ogd keys add "$keyname" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" # Fund the account in genesis add_genesis_funds "$keyname" @@ -304,7 +304,7 @@ jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x000000000000000 keyname="dev${idx}" # create key and capture mnemonic - mnemonic_out="$(evmd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" 2>&1)" + mnemonic_out="$(ogd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" 2>&1)" # try to grab a line that looks like a seed phrase (>=12 words), else last line user_mnemonic="$(echo "$mnemonic_out" | grep -E '([[:alpha:]]+[[:space:]]+){11,}[[:alpha:]]+$' | tail -1)" if [[ -z "$user_mnemonic" ]]; then @@ -323,9 +323,9 @@ jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x000000000000000 fi # --------- Finalize genesis --------- - evmd genesis gentx "$VAL_KEY" 10000000000000000000000ogwei --gas-prices ${BASEFEE}ogwei --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" - evmd genesis collect-gentxs --home "$CHAINDIR" - evmd genesis validate-genesis --home "$CHAINDIR" + ogd genesis gentx "$VAL_KEY" 10000000000000000000000ogwei --gas-prices ${BASEFEE}ogwei --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" + ogd genesis collect-gentxs --home "$CHAINDIR" + ogd genesis validate-genesis --home "$CHAINDIR" # --------- Write YAML with mnemonics if the user specified more --------- if [[ "$ADDITIONAL_USERS" -gt 0 ]]; then @@ -338,7 +338,7 @@ jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x000000000000000 fi # Start the node -evmd start "$TRACE" \ +ogd start "$TRACE" \ --pruning nothing \ --log_level $LOGLEVEL \ --minimum-gas-prices=0ogwei \ diff --git a/multi_node_startup.sh b/multi_node_startup.sh index b34ada58..c94b6e8e 100755 --- a/multi_node_startup.sh +++ b/multi_node_startup.sh @@ -70,7 +70,7 @@ apply_genesis_customizations() { jq '.app_state["evm"]["params"]["evm_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OGETH","exponent":18,"aliases":[]}],"base":"ogwei","display":"OGETH","name":"ETH Token","symbol":"OGETH","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for ogd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OGETH","exponent":18,"aliases":[]}],"base":"ogwei","display":"OGETH","name":"ETH Token","symbol":"OGETH","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805","0x0000000000000000000000000000000000000806","0x0000000000000000000000000000000000000807"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -167,13 +167,13 @@ generate_dev_accounts() { rm -rf "$DEV_HOME" mkdir -p "$DEV_HOME" - local FULL_OUTPUT=$(evmd keys add "$KEYNAME" --keyring-backend test --algo "$KEYALGO" --home "$DEV_HOME" 2>&1) + local FULL_OUTPUT=$(ogd keys add "$KEYNAME" --keyring-backend test --algo "$KEYALGO" --home "$DEV_HOME" 2>&1) local MNEMONIC=$(echo "$FULL_OUTPUT" | tail -1) - local ADDRESS=$(evmd keys show "$KEYNAME" -a --keyring-backend test --home "$DEV_HOME") - local PRIVKEY=$(evmd keys unsafe-export-eth-key "$KEYNAME" --keyring-backend test --home "$DEV_HOME" 2>&1) + local ADDRESS=$(ogd keys show "$KEYNAME" -a --keyring-backend test --home "$DEV_HOME") + local PRIVKEY=$(ogd keys unsafe-export-eth-key "$KEYNAME" --keyring-backend test --home "$DEV_HOME" 2>&1) - evmd genesis add-genesis-account "$ADDRESS" 1000000000000000000000000ogwei --home "$GENESIS_HOME" + ogd genesis add-genesis-account "$ADDRESS" 1000000000000000000000000ogwei --home "$GENESIS_HOME" echo "" >> "$OUTPUT_FILE" echo "dev${i}:" >> "$OUTPUT_FILE" @@ -220,14 +220,14 @@ generate_genesis() { echo "--- Initializing validator $i at $HOME_DIR ---" - evmd config set client chain-id "$CHAINID" --home "$HOME_DIR" - evmd config set client keyring-backend "$KEYRING" --home "$HOME_DIR" + ogd config set client chain-id "$CHAINID" --home "$HOME_DIR" + ogd config set client keyring-backend "$KEYRING" --home "$HOME_DIR" - echo "$MNEMONIC" | evmd keys add "$VALKEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOME_DIR" + echo "$MNEMONIC" | ogd keys add "$VALKEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$HOME_DIR" - echo "$MNEMONIC" | evmd init "${MONIKER}-val${i}" -o --chain-id "$CHAINID" --home "$HOME_DIR" --recover + echo "$MNEMONIC" | ogd init "${MONIKER}-val${i}" -o --chain-id "$CHAINID" --home "$HOME_DIR" --recover - NODE_ID=$(evmd comet show-node-id --home "$HOME_DIR") + NODE_ID=$(ogd comet show-node-id --home "$HOME_DIR") NODE_IDS+=("$NODE_ID") echo "Validator $i Node ID: $NODE_ID" done @@ -243,10 +243,10 @@ generate_genesis() { VALKEY="val${i}" VAL_HOME=$(get_home_dir $i) - VAL_ADDR=$(evmd keys show "$VALKEY" -a --keyring-backend "$KEYRING" --home "$VAL_HOME") + VAL_ADDR=$(ogd keys show "$VALKEY" -a --keyring-backend "$KEYRING" --home "$VAL_HOME") echo "Adding $VALKEY ($VAL_ADDR) with 100000000000000000000000000ogwei" - evmd genesis add-genesis-account "$VAL_ADDR" 100000000000000000000000000ogwei --home "$(get_home_dir 0)" + ogd genesis add-genesis-account "$VAL_ADDR" 100000000000000000000000000ogwei --home "$(get_home_dir 0)" done echo "" @@ -268,7 +268,7 @@ generate_genesis() { P2P_PORT=$(get_p2p_port $i) echo "Creating gentx for $VALKEY (P2P port: $P2P_PORT)..." - evmd genesis gentx "$VALKEY" 10000000000000000000000ogwei \ + ogd genesis gentx "$VALKEY" 10000000000000000000000ogwei \ --gas-prices ${BASEFEE}ogwei \ --keyring-backend "$KEYRING" \ --chain-id "$CHAINID" \ @@ -285,8 +285,8 @@ generate_genesis() { echo "Copied gentx from val$i" done - evmd genesis collect-gentxs --home "$(get_home_dir 0)" - evmd genesis validate-genesis --home "$(get_home_dir 0)" + ogd genesis collect-gentxs --home "$(get_home_dir 0)" + ogd genesis validate-genesis --home "$(get_home_dir 0)" echo "Genesis validated successfully!" echo "" @@ -364,7 +364,7 @@ start_validator() { echo "JSON-RPC: $JSONRPC_PORT" echo "==========================================" - evmd start \ + ogd start \ --pruning nothing \ --log_level "$LOGLEVEL" \ --minimum-gas-prices=0ogwei \ diff --git a/tests/jsonrpc/scripts/evmd/container-start-evmd.sh b/tests/jsonrpc/scripts/ogd/container-start-ogd.sh similarity index 58% rename from tests/jsonrpc/scripts/evmd/container-start-evmd.sh rename to tests/jsonrpc/scripts/ogd/container-start-ogd.sh index 05548e62..34bb38d2 100755 --- a/tests/jsonrpc/scripts/evmd/container-start-evmd.sh +++ b/tests/jsonrpc/scripts/ogd/container-start-ogd.sh @@ -1,13 +1,13 @@ #!/bin/bash -# Container-friendly evmd initialization and startup script -# This runs inside the evmd container, so no Docker commands +# Container-friendly ogd initialization and startup script +# This runs inside the ogd container, so no Docker commands set -e -echo "🔧 Starting evmd container initialization..." +echo "🔧 Starting ogd container initialization..." -# Set up variables (same as start-evmd.sh) +# Set up variables (same as start-ogd.sh) KEYRING="test" KEYALGO="eth_secp256k1" CHAINDIR="/data" @@ -16,7 +16,7 @@ TMP_GENESIS="$CHAINDIR/config/tmp_genesis.json" CHAIN_ID="local-4221" BASEFEE=10000000 -# Standard test keys (same as start-evmd.sh) +# Standard test keys (same as start-ogd.sh) VAL_KEY="mykey" VAL_MNEMONIC="gesture inject test cycle original hollow east ridge hen combine junk child bacon zero hope comfort vacuum milk pitch cage oppose unhappy lunar seat" @@ -34,19 +34,19 @@ USER4_MNEMONIC="doll midnight silk carpet brush boring pluck office gown inquiry # Initialize chain directly (no Docker wrapper) echo "🔧 Initializing chain..." -echo "$VAL_MNEMONIC" | evmd init localtestnet -o --chain-id "$CHAIN_ID" --recover --home "$CHAINDIR" +echo "$VAL_MNEMONIC" | ogd init localtestnet -o --chain-id "$CHAIN_ID" --recover --home "$CHAINDIR" # Set client config -evmd config set client chain-id "$CHAIN_ID" --home "$CHAINDIR" -evmd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd config set client chain-id "$CHAIN_ID" --home "$CHAINDIR" +ogd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" # Add keys echo "🔧 Adding standard test keys..." -echo "$VAL_MNEMONIC" | evmd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" -echo "$USER1_MNEMONIC" | evmd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" -echo "$USER2_MNEMONIC" | evmd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" -echo "$USER3_MNEMONIC" | evmd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" -echo "$USER4_MNEMONIC" | evmd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" +echo "$VAL_MNEMONIC" | ogd keys add "$VAL_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" +echo "$USER1_MNEMONIC" | ogd keys add "$USER1_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" +echo "$USER2_MNEMONIC" | ogd keys add "$USER2_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" +echo "$USER3_MNEMONIC" | ogd keys add "$USER3_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" +echo "$USER4_MNEMONIC" | ogd keys add "$USER4_KEY" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" # Configure genesis file echo "🔧 Configuring genesis file..." @@ -54,22 +54,22 @@ jq '.app_state["staking"]["params"]["bond_denom"]="atest"' "$GENESIS" > "$TMP_GE jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" > "$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="atest"' "$GENESIS" > "$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["gov"]["params"]["expedited_min_deposit"][0]["denom"]="atest"' "$GENESIS" > "$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" -jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"atest","exponent":0,"aliases":["attotest"]},{"denom":"test","exponent":18,"aliases":[]}],"base":"atest","display":"test","name":"Test Token","symbol":"TEST","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" +jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for ogd.","denom_units":[{"denom":"atest","exponent":0,"aliases":["attotest"]},{"denom":"test","exponent":18,"aliases":[]}],"base":"atest","display":"test","name":"Test Token","symbol":"TEST","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$GENESIS" > "$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="atest"' "$GENESIS" > "$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" # Add genesis accounts echo "🔧 Setting up genesis accounts..." -evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" -evmd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd genesis add-genesis-account "$USER1_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd genesis add-genesis-account "$USER2_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd genesis add-genesis-account "$USER3_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" +ogd genesis add-genesis-account "$USER4_KEY" 1000000000000000000000atest --keyring-backend "$KEYRING" --home "$CHAINDIR" # Generate validator transaction -evmd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices "${BASEFEE}atest" --keyring-backend "$KEYRING" --chain-id "$CHAIN_ID" --home "$CHAINDIR" -evmd genesis collect-gentxs --home "$CHAINDIR" -evmd genesis validate-genesis --home "$CHAINDIR" +ogd genesis gentx "$VAL_KEY" 1000000000000000000000atest --gas-prices "${BASEFEE}atest" --keyring-backend "$KEYRING" --chain-id "$CHAIN_ID" --home "$CHAINDIR" +ogd genesis collect-gentxs --home "$CHAINDIR" +ogd genesis validate-genesis --home "$CHAINDIR" # Reduce block time by adjusting consensus timeouts CONFIG_TOML="$CHAINDIR/config/config.toml" @@ -81,8 +81,8 @@ sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "100ms"/g' "$C sed -i 's/timeout_precommit = "1s"/timeout_precommit = "300ms"/g' "$CONFIG_TOML" sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "100ms"/g' "$CONFIG_TOML" -echo "🚀 Starting evmd..." -exec evmd start \ +echo "🚀 Starting ogd..." +exec ogd start \ --home "$CHAINDIR" \ --minimum-gas-prices=0.0001atest \ --json-rpc.enable \ diff --git a/tests/jsonrpc/scripts/evmd/start-evmd.sh b/tests/jsonrpc/scripts/ogd/start-ogd.sh similarity index 81% rename from tests/jsonrpc/scripts/evmd/start-evmd.sh rename to tests/jsonrpc/scripts/ogd/start-ogd.sh index 4d7f5286..47ca865f 100755 --- a/tests/jsonrpc/scripts/evmd/start-evmd.sh +++ b/tests/jsonrpc/scripts/ogd/start-ogd.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Start single evmd node for JSON-RPC compatibility testing +# Start single ogd node for JSON-RPC compatibility testing set -e @@ -8,8 +8,8 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/../../../.." && pwd)" # Configuration -CONTAINER_NAME="evmd-jsonrpc-test" -DATA_DIR="$PROJECT_ROOT/tests/jsonrpc/.evmd" +CONTAINER_NAME="ogd-jsonrpc-test" +DATA_DIR="$PROJECT_ROOT/tests/jsonrpc/.ogd" VALIDATOR_COUNT=1 CHAIN_ID="local-4221" @@ -19,11 +19,11 @@ GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo -e "${GREEN}Starting evmd for JSON-RPC testing...${NC}" +echo -e "${GREEN}Starting ogd for JSON-RPC testing...${NC}" # Check if Docker image exists -if ! docker image inspect cosmos/evmd >/dev/null 2>&1; then - echo -e "${RED}Error: cosmos/evmd Docker image not found${NC}" +if ! docker image inspect cosmos/ogd >/dev/null 2>&1; then + echo -e "${RED}Error: cosmos/ogd Docker image not found${NC}" echo -e "${YELLOW}Please run: make localnet-build-env${NC}" exit 1 fi @@ -73,20 +73,20 @@ USER4_MNEMONIC="doll midnight silk carpet brush boring pluck office gown inquiry # Initialize using single Docker container with initialization script echo -e "${GREEN}Initializing chain with single Docker container...${NC}" -docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/evmd bash -c " +docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/ogd bash -c " # Initialize chain - echo '$VAL_MNEMONIC' | evmd init localtestnet -o --chain-id '$CHAIN_ID' --recover --home /data + echo '$VAL_MNEMONIC' | ogd init localtestnet -o --chain-id '$CHAIN_ID' --recover --home /data # Set client config - evmd config set client chain-id '$CHAIN_ID' --home /data - evmd config set client keyring-backend '$KEYRING' --home /data + ogd config set client chain-id '$CHAIN_ID' --home /data + ogd config set client keyring-backend '$KEYRING' --home /data # Import keys from mnemonics - echo '$VAL_MNEMONIC' | evmd keys add '$VAL_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data - echo '$USER1_MNEMONIC' | evmd keys add '$USER1_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data - echo '$USER2_MNEMONIC' | evmd keys add '$USER2_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data - echo '$USER3_MNEMONIC' | evmd keys add '$USER3_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data - echo '$USER4_MNEMONIC' | evmd keys add '$USER4_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data + echo '$VAL_MNEMONIC' | ogd keys add '$VAL_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data + echo '$USER1_MNEMONIC' | ogd keys add '$USER1_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data + echo '$USER2_MNEMONIC' | ogd keys add '$USER2_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data + echo '$USER3_MNEMONIC' | ogd keys add '$USER3_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data + echo '$USER4_MNEMONIC' | ogd keys add '$USER4_KEY' --recover --keyring-backend '$KEYRING' --algo '$KEYALGO' --home /data " # Configure genesis file using jq directly on host @@ -100,7 +100,7 @@ jq '.app_state["evm"]["params"]["evm_denom"]="atest"' "$DATA_DIR/config/genesis. jq '.app_state["mint"]["params"]["mint_denom"]="atest"' "$DATA_DIR/config/genesis.json" > "$DATA_DIR/config/tmp_genesis.json" && mv "$DATA_DIR/config/tmp_genesis.json" "$DATA_DIR/config/genesis.json" # Add default token metadata to genesis -jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"atest","exponent":0,"aliases":["attotest"]},{"denom":"test","exponent":18,"aliases":[]}],"base":"atest","display":"test","name":"Test Token","symbol":"TEST","uri":"","uri_hash":""}]' "$DATA_DIR/config/genesis.json" > "$DATA_DIR/config/tmp_genesis.json" && mv "$DATA_DIR/config/tmp_genesis.json" "$DATA_DIR/config/genesis.json" +jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for ogd.","denom_units":[{"denom":"atest","exponent":0,"aliases":["attotest"]},{"denom":"test","exponent":18,"aliases":[]}],"base":"atest","display":"test","name":"Test Token","symbol":"TEST","uri":"","uri_hash":""}]' "$DATA_DIR/config/genesis.json" > "$DATA_DIR/config/tmp_genesis.json" && mv "$DATA_DIR/config/tmp_genesis.json" "$DATA_DIR/config/genesis.json" # Enable precompiles in EVM params jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805", "0x0000000000000000000000000000000000000806", "0x0000000000000000000000000000000000000807"]' "$DATA_DIR/config/genesis.json" > "$DATA_DIR/config/tmp_genesis.json" && mv "$DATA_DIR/config/tmp_genesis.json" "$DATA_DIR/config/genesis.json" @@ -118,24 +118,24 @@ jq '.consensus.params.block.max_gas="10000000"' "$DATA_DIR/config/genesis.json" # Add genesis accounts and generate validator transaction echo -e "${GREEN}Setting up genesis accounts and validator...${NC}" -docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/evmd bash -c " +docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/ogd bash -c " # Allocate genesis accounts - evmd genesis add-genesis-account '$VAL_KEY' 100000000000000000000000000atest --keyring-backend '$KEYRING' --home /data - evmd genesis add-genesis-account '$USER1_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data - evmd genesis add-genesis-account '$USER2_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data - evmd genesis add-genesis-account '$USER3_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data - evmd genesis add-genesis-account '$USER4_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data + ogd genesis add-genesis-account '$VAL_KEY' 100000000000000000000000000atest --keyring-backend '$KEYRING' --home /data + ogd genesis add-genesis-account '$USER1_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data + ogd genesis add-genesis-account '$USER2_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data + ogd genesis add-genesis-account '$USER3_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data + ogd genesis add-genesis-account '$USER4_KEY' 1000000000000000000000atest --keyring-backend '$KEYRING' --home /data # Generate and collect validator transaction - evmd genesis gentx '$VAL_KEY' 1000000000000000000000atest --gas-prices '${BASEFEE}atest' --keyring-backend '$KEYRING' --chain-id '$CHAIN_ID' --home /data - evmd genesis collect-gentxs --home /data - evmd genesis validate-genesis --home /data + ogd genesis gentx '$VAL_KEY' 1000000000000000000000atest --gas-prices '${BASEFEE}atest' --keyring-backend '$KEYRING' --chain-id '$CHAIN_ID' --home /data + ogd genesis collect-gentxs --home /data + ogd genesis validate-genesis --home /data " # Configure node settings using Docker echo -e "${GREEN}Configuring node settings...${NC}" -docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/evmd bash -c " +docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" cosmos/ogd bash -c " # Configure consensus timeouts for faster block times (500ms block time) sed -i 's/timeout_propose = \"3s\"/timeout_propose = \"1s\"/g' /data/config/config.toml sed -i 's/timeout_propose_delta = \"500ms\"/timeout_propose_delta = \"100ms\"/g' /data/config/config.toml @@ -170,8 +170,8 @@ docker run --rm --privileged -v "$DATA_DIR:/data" --user root --entrypoint="" co echo -e "${GREEN}Configuration completed${NC}" -# Start the evmd container -echo -e "${GREEN}Starting evmd container...${NC}" +# Start the ogd container +echo -e "${GREEN}Starting ogd container...${NC}" CONTAINER_ID=$(docker run -d \ --name "$CONTAINER_NAME" \ --rm \ @@ -183,7 +183,7 @@ CONTAINER_ID=$(docker run -d \ -p 9090:9090 \ -e ID=0 \ -v "$DATA_DIR:/data" \ - cosmos/evmd \ + cosmos/ogd \ start \ --home /data \ --minimum-gas-prices=0.0001atest \ @@ -253,7 +253,7 @@ if [ "$FINAL_STATUS" != "running" ]; then exit 1 fi -echo -e "${GREEN}evmd started successfully!${NC}" +echo -e "${GREEN}ogd started successfully!${NC}" echo -e "${YELLOW}Endpoints:${NC}" echo -e " JSON-RPC: http://localhost:8545" echo -e " WebSocket: ws://localhost:8546" @@ -262,4 +262,4 @@ echo -e " Tendermint RPC: http://localhost:26657" echo -e " gRPC: localhost:9090" echo echo -e "${YELLOW}To view logs: docker logs -f $CONTAINER_NAME${NC}" -echo -e "${YELLOW}To stop: $SCRIPT_DIR/stop-evmd.sh${NC}" +echo -e "${YELLOW}To stop: $SCRIPT_DIR/stop-ogd.sh${NC}" diff --git a/tests/jsonrpc/scripts/evmd/stop-evmd.sh b/tests/jsonrpc/scripts/ogd/stop-ogd.sh similarity index 67% rename from tests/jsonrpc/scripts/evmd/stop-evmd.sh rename to tests/jsonrpc/scripts/ogd/stop-ogd.sh index 5ff230b8..2bf90414 100755 --- a/tests/jsonrpc/scripts/evmd/stop-evmd.sh +++ b/tests/jsonrpc/scripts/ogd/stop-ogd.sh @@ -1,11 +1,11 @@ #!/bin/bash -# Stop evmd node for JSON-RPC testing +# Stop ogd node for JSON-RPC testing set -e # Configuration -CONTAINER_NAME="evmd-jsonrpc-test" +CONTAINER_NAME="ogd-jsonrpc-test" # Colors for output RED='\033[0;31m' @@ -13,13 +13,13 @@ GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo -e "${GREEN}Stopping evmd for JSON-RPC testing...${NC}" +echo -e "${GREEN}Stopping ogd for JSON-RPC testing...${NC}" # Stop container if running if docker container inspect "$CONTAINER_NAME" >/dev/null 2>&1; then echo -e "${YELLOW}Stopping container...${NC}" docker stop "$CONTAINER_NAME" >/dev/null 2>&1 - echo -e "${GREEN}evmd stopped successfully${NC}" + echo -e "${GREEN}ogd stopped successfully${NC}" else echo -e "${YELLOW}Container is not running${NC}" fi \ No newline at end of file diff --git a/tests/jsonrpc/scripts/run-compat-test.sh b/tests/jsonrpc/scripts/run-compat-test.sh index fe11ee33..071d4f4b 100755 --- a/tests/jsonrpc/scripts/run-compat-test.sh +++ b/tests/jsonrpc/scripts/run-compat-test.sh @@ -11,12 +11,12 @@ JSONRPC_DIR="$PROJECT_ROOT/tests/jsonrpc" echo "🔍 Checking Docker image requirements..." -# Check evmd image and build if needed -if ! docker image inspect cosmos/evmd >/dev/null 2>&1; then - echo "📦 Building cosmos/evmd image..." +# Check ogd image and build if needed +if ! docker image inspect cosmos/ogd >/dev/null 2>&1; then + echo "📦 Building cosmos/ogd image..." make -C "$PROJECT_ROOT" localnet-build-env else - echo "✓ cosmos/evmd image already exists, skipping build" + echo "✓ cosmos/ogd image already exists, skipping build" fi # Check if simulator image already exists @@ -26,20 +26,20 @@ else echo "📦 Will build simulator image..." fi -# Initialize evmd data directory -echo "🔧 Preparing evmd data directory..." +# Initialize ogd data directory +echo "🔧 Preparing ogd data directory..." # Clear existing directory to avoid key conflicts -if [ -d "$JSONRPC_DIR/.evmd" ]; then - echo "🧹 Removing existing .evmd directory..." - rm -rf "$JSONRPC_DIR/.evmd" +if [ -d "$JSONRPC_DIR/.ogd" ]; then + echo "🧹 Removing existing .ogd directory..." + rm -rf "$JSONRPC_DIR/.ogd" fi # Create fresh directory with correct permissions -mkdir -p "$JSONRPC_DIR/.evmd" -chmod 777 "$JSONRPC_DIR/.evmd" +mkdir -p "$JSONRPC_DIR/.ogd" +chmod 777 "$JSONRPC_DIR/.ogd" -echo "🔧 evmd will auto-initialize when container starts..." +echo "🔧 ogd will auto-initialize when container starts..." # Run the compatibility tests echo "🚀 Running JSON-RPC compatibility tests..." diff --git a/tests/jsonrpc/scripts/start-networks.sh b/tests/jsonrpc/scripts/start-networks.sh index 66b689c0..af9658c4 100755 --- a/tests/jsonrpc/scripts/start-networks.sh +++ b/tests/jsonrpc/scripts/start-networks.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Start both evmd and geth for JSON-RPC compatibility testing +# Start both ogd and geth for JSON-RPC compatibility testing set -e @@ -12,11 +12,11 @@ GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo -e "${GREEN}Starting both evmd and geth for compatibility testing...${NC}" +echo -e "${GREEN}Starting both ogd and geth for compatibility testing...${NC}" -# Start evmd -echo -e "${YELLOW}Starting evmd...${NC}" -"$SCRIPT_DIR/evmd/start-evmd.sh" +# Start ogd +echo -e "${YELLOW}Starting ogd...${NC}" +"$SCRIPT_DIR/ogd/start-ogd.sh" echo echo -e "${YELLOW}Starting geth...${NC}" @@ -25,8 +25,8 @@ echo -e "${YELLOW}Starting geth...${NC}" echo echo -e "${GREEN}Both nodes started successfully!${NC}" echo -e "${YELLOW}Endpoints:${NC}" -echo -e " evmd JSON-RPC: http://localhost:8545" -echo -e " evmd WebSocket: ws://localhost:8546" +echo -e " ogd JSON-RPC: http://localhost:8545" +echo -e " ogd WebSocket: ws://localhost:8546" echo -e " geth JSON-RPC: http://localhost:8547" echo -e " geth WebSocket: ws://localhost:8548" echo diff --git a/tests/jsonrpc/scripts/stop-networks.sh b/tests/jsonrpc/scripts/stop-networks.sh index 033f4beb..61bf1357 100755 --- a/tests/jsonrpc/scripts/stop-networks.sh +++ b/tests/jsonrpc/scripts/stop-networks.sh @@ -1,6 +1,6 @@ #!/bin/bash -# Stop both evmd and geth nodes +# Stop both ogd and geth nodes set -e @@ -12,11 +12,11 @@ GREEN='\033[0;32m' YELLOW='\033[1;33m' NC='\033[0m' # No Color -echo -e "${GREEN}Stopping both evmd and geth...${NC}" +echo -e "${GREEN}Stopping both ogd and geth...${NC}" -# Stop evmd -echo -e "${YELLOW}Stopping evmd...${NC}" -"$SCRIPT_DIR/evmd/stop-evmd.sh" +# Stop ogd +echo -e "${YELLOW}Stopping ogd...${NC}" +"$SCRIPT_DIR/ogd/stop-ogd.sh" echo echo -e "${YELLOW}Stopping geth...${NC}" From 7165ea401c0a696ea9275063d17d2b642fdbe1d9 Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Thu, 12 Mar 2026 11:50:18 +0100 Subject: [PATCH 05/12] refactor: update scripts, configs, and docker setup for ogd rename Changes: - Update all test compatibility scripts (hardhat, viem, common) - Update test_deployment.sh with ogd CLI commands - Update docker-compose.yml: rename service, container, env vars - Update tests/jsonrpc/README.md with ogd references - Change temp directories and log paths in scripts --- evmd/config/config.go | 2 +- scripts/run-solidity-tests.sh | 4 +-- scripts/tests_compatibility_common.sh | 10 ++++---- scripts/tests_compatibility_hardhat.sh | 2 +- scripts/tests_compatibility_viem.sh | 2 +- test_deployment.sh | 32 ++++++++++++------------ tests/jsonrpc/README.md | 34 +++++++++++++------------- tests/jsonrpc/docker-compose.yml | 22 ++++++++--------- 8 files changed, 54 insertions(+), 54 deletions(-) diff --git a/evmd/config/config.go b/evmd/config/config.go index 37161612..8adb2950 100644 --- a/evmd/config/config.go +++ b/evmd/config/config.go @@ -7,7 +7,7 @@ import ( ) func MustGetDefaultNodeHome() string { - defaultNodeHome, err := clienthelpers.GetNodeHomeDirectory(".evmd") + defaultNodeHome, err := clienthelpers.GetNodeHomeDirectory(".ogd") if err != nil { panic(err) } diff --git a/scripts/run-solidity-tests.sh b/scripts/run-solidity-tests.sh index 1aecd33c..ac9100bc 100755 --- a/scripts/run-solidity-tests.sh +++ b/scripts/run-solidity-tests.sh @@ -4,12 +4,12 @@ export GOPATH="$HOME"/go export PATH="$PATH":"$GOPATH"/bin # remove existing data -rm -rf "$HOME"/.tmp-evmd-solidity-tests +rm -rf "$HOME"/.tmp-ogd-solidity-tests # used to exit on first error (any non-zero exit code) set -e -# build evmd binary +# build ogd binary make install cd tests/solidity || exit diff --git a/scripts/tests_compatibility_common.sh b/scripts/tests_compatibility_common.sh index f4c5d7c0..464d5430 100755 --- a/scripts/tests_compatibility_common.sh +++ b/scripts/tests_compatibility_common.sh @@ -6,14 +6,14 @@ set -euo pipefail ROOT="$(git rev-parse --show-toplevel)" -# Start evmd node in background +# Start ogd node in background start_node() { local print_log="${1:-false}" pushd "$ROOT" >/dev/null if [ "$print_log" = true ]; then ./local_node.sh -y & else - ./local_node.sh -y >/tmp/evmd.log 2>&1 & + ./local_node.sh -y >/tmp/ogd.log 2>&1 & fi NODE_PID=$! popd >/dev/null @@ -25,7 +25,7 @@ wait_for_node() { local rpc="http://127.0.0.1:8545" local timeout=60 local elapsed=0 - echo "Waiting for evmd node to be ready..." + echo "Waiting for ogd node to be ready..." while [ $elapsed -lt $timeout ]; do RESPONSE=$(curl -s -X POST -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' \ @@ -50,7 +50,7 @@ wait_for_node() { echo "Error: Node failed to reach block $target within $timeout seconds" echo "Last response: $RESPONSE" echo "Checking node logs:" - tail -20 /tmp/evmd.log 2>/dev/null || echo "No evmd logs found" + tail -20 /tmp/ogd.log 2>/dev/null || echo "No ogd logs found" exit 1 fi } @@ -58,7 +58,7 @@ wait_for_node() { # Stop the node cleanup_node() { if [ -n "${NODE_PID:-}" ]; then - echo "Stopping evmd node..." + echo "Stopping ogd node..." kill "$NODE_PID" 2>/dev/null || true wait "$NODE_PID" 2>/dev/null || true fi diff --git a/scripts/tests_compatibility_hardhat.sh b/scripts/tests_compatibility_hardhat.sh index 753102d6..2d16f054 100755 --- a/scripts/tests_compatibility_hardhat.sh +++ b/scripts/tests_compatibility_hardhat.sh @@ -44,7 +44,7 @@ trap cleanup_node EXIT sleep 3 # Wait for the node to be ready -echo "Waiting for evmd node to be ready..." +echo "Waiting for ogd node to be ready..." wait_for_node 10 diff --git a/scripts/tests_compatibility_viem.sh b/scripts/tests_compatibility_viem.sh index bb885b2f..4146239c 100755 --- a/scripts/tests_compatibility_viem.sh +++ b/scripts/tests_compatibility_viem.sh @@ -44,7 +44,7 @@ trap cleanup_node EXIT sleep 3 # Wait for the node to be ready -echo "Waiting for evmd node to be ready..." +echo "Waiting for ogd node to be ready..." wait_for_node 10 diff --git a/test_deployment.sh b/test_deployment.sh index b23385fa..6432546f 100755 --- a/test_deployment.sh +++ b/test_deployment.sh @@ -9,7 +9,7 @@ KEYRING="test" KEYALGO="eth_secp256k1" LOGLEVEL="info" -# Set dedicated home directory for the evmd instance +# Set dedicated home directory for the ogd instance CHAINDIR="$HOME/.og-evm-devnet" BASEFEE=10000000 @@ -47,7 +47,7 @@ Options: --no-install Skip 'make install' --remote-debugging Build with nooptimization,nostrip --additional-users N Create N extra users: dev4, dev5, ... - --mnemonic-file PATH Where to write mnemonics YAML (default: \$HOME/.evmd/mnemonics.yaml) + --mnemonic-file PATH Where to write mnemonics YAML (default: \$HOME/.ogd/mnemonics.yaml) --mnemonics-input PATH Read dev mnemonics from a yaml file (key: mnemonics:) EOF } @@ -64,7 +64,7 @@ while [[ $# -gt 0 ]]; do overwrite="n"; shift ;; --no-install) - echo "Flag --no-install passed -> Skipping installation of the evmd binary." + echo "Flag --no-install passed -> Skipping installation of the ogd binary." install=false; shift ;; --remote-debugging) @@ -168,17 +168,17 @@ write_mnemonics_yaml() { # ---------- Add funded account ---------- add_genesis_funds() { local keyname="$1" - evmd genesis add-genesis-account "$keyname" 1000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd genesis add-genesis-account "$keyname" 1000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" } # Setup local node if overwrite is set to Yes, otherwise skip setup if [[ $overwrite == "y" || $overwrite == "Y" ]]; then - evmd config set client chain-id "$CHAINID" --home "$CHAINDIR" - evmd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd config set client chain-id "$CHAINID" --home "$CHAINDIR" + ogd config set client keyring-backend "$KEYRING" --home "$CHAINDIR" # ---------------- Validator key ---------------- VAL_KEY="mykey" - evmd keys add "$VAL_KEY" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" + ogd keys add "$VAL_KEY" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" provided_mnemonics=() @@ -211,7 +211,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then fi # init chain w/ validator mnemonic - evmd init $MONIKER -o --chain-id "$CHAINID" --home "$CHAINDIR" + ogd init $MONIKER -o --chain-id "$CHAINID" --home "$CHAINDIR" # ---------- Genesis customizations ---------- jq '.app_state["staking"]["params"]["bond_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -221,7 +221,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then jq '.app_state["evm"]["params"]["evm_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["mint"]["params"]["mint_denom"]="ogwei"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" - jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for evmd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OGETH","exponent":18,"aliases":[]}],"base":"ogwei","display":"OGETH","name":"ETH Token","symbol":"OGETH","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" + jq '.app_state["bank"]["denom_metadata"]=[{"description":"The native staking token for ogd.","denom_units":[{"denom":"ogwei","exponent":0,"aliases":[]},{"denom":"OGETH","exponent":18,"aliases":[]}],"base":"ogwei","display":"OGETH","name":"ETH Token","symbol":"OGETH","uri":"","uri_hash":""}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" jq '.app_state["evm"]["params"]["active_static_precompiles"]=["0x0000000000000000000000000000000000000100","0x0000000000000000000000000000000000000400","0x0000000000000000000000000000000000000800","0x0000000000000000000000000000000000000801","0x0000000000000000000000000000000000000802","0x0000000000000000000000000000000000000803","0x0000000000000000000000000000000000000804","0x0000000000000000000000000000000000000805", "0x0000000000000000000000000000000000000806", "0x0000000000000000000000000000000000000807"]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS" @@ -238,7 +238,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then sed -i.bak 's/"expedited_voting_period": "86400s"/"expedited_voting_period": "15s"/g' "$GENESIS" # fund validator (devs already funded in the loop) - evmd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" + ogd genesis add-genesis-account "$VAL_KEY" 100000000000000000000000000ogwei --keyring-backend "$KEYRING" --home "$CHAINDIR" # ---------- Config customizations ---------- sed -i.bak 's/timeout_propose = "3s"/timeout_propose = "2s"/g' "$CONFIG_TOML" @@ -273,7 +273,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then echo "adding key for $keyname" # Create key - evmd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" + ogd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" # Fund the account in genesis add_genesis_funds "$keyname" @@ -286,7 +286,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then keyname="dev${idx}" # create key and capture mnemonic - mnemonic_out="$(evmd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" 2>&1)" + mnemonic_out="$(ogd keys add "$keyname" --keyring-backend "$KEYRING" --algo "$KEYALGO" --home "$CHAINDIR" 2>&1)" # try to grab a line that looks like a seed phrase (>=12 words), else last line user_mnemonic="$(echo "$mnemonic_out" | grep -E '([[:alpha:]]+[[:space:]]+){11,}[[:alpha:]]+$' | tail -1)" if [[ -z "$user_mnemonic" ]]; then @@ -305,9 +305,9 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then fi # --------- Finalize genesis --------- - evmd genesis gentx "$VAL_KEY" 1000000000000000000000ogwei --gas-prices ${BASEFEE}ogwei --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" - evmd genesis collect-gentxs --home "$CHAINDIR" - evmd genesis validate-genesis --home "$CHAINDIR" + ogd genesis gentx "$VAL_KEY" 1000000000000000000000ogwei --gas-prices ${BASEFEE}ogwei --keyring-backend "$KEYRING" --chain-id "$CHAINID" --home "$CHAINDIR" + ogd genesis collect-gentxs --home "$CHAINDIR" + ogd genesis validate-genesis --home "$CHAINDIR" # --------- Write YAML with mnemonics if the user specified more --------- if [[ "$ADDITIONAL_USERS" -gt 0 ]]; then @@ -320,7 +320,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then fi # Start the node -evmd start "$TRACE" \ +ogd start "$TRACE" \ --pruning nothing \ --log_level $LOGLEVEL \ --minimum-gas-prices=0ogwei \ diff --git a/tests/jsonrpc/README.md b/tests/jsonrpc/README.md index 0d0f5ada..56609894 100644 --- a/tests/jsonrpc/README.md +++ b/tests/jsonrpc/README.md @@ -11,7 +11,7 @@ make test-rpc-compat ## Test Guide -### 1. Build EVMD Docker Image +### 1. Build ogd Docker Image ```bash # From project root @@ -21,8 +21,8 @@ make localnet-build-env ### 2. Start Nodes ```bash -# Start evmd with JSON-RPC enabled -./tests/jsonrpc/scripts/evmd/start-evmd.sh +# Start ogd with JSON-RPC enabled +./tests/jsonrpc/scripts/ogd/start-ogd.sh # Start geth for comparison ./tests/jsonrpc/scripts/geth/start-geth.sh @@ -43,8 +43,8 @@ go build . ### 4. Stop Nodes ```bash -# Stop evmd -./tests/jsonrpc/scripts/evmd/stop-evmd.sh +# Stop ogd +./tests/jsonrpc/scripts/ogd/stop-ogd.sh # Stop geth ./tests/jsonrpc/scripts/geth/stop-geth.sh @@ -55,7 +55,7 @@ go build . ## Available Endpoints -### evmd Endpoints +### ogd Endpoints - **JSON-RPC**: http://localhost:8545 - **WebSocket**: http://localhost:8546 @@ -70,10 +70,10 @@ go build . ## Scripts Structure -### `scripts/evmd/` +### `scripts/ogd/` -- `start-evmd.sh` - Initialize and start single-node evmd for testing -- `stop-evmd.sh` - Stop the evmd testing node +- `start-ogd.sh` - Initialize and start single-node ogd for testing +- `stop-ogd.sh` - Stop the ogd testing node ### `scripts/geth/` @@ -82,7 +82,7 @@ go build . ### `scripts/` -- `start-both.sh` - Start both evmd and geth nodes +- `start-both.sh` - Start both ogd and geth nodes - `stop-both.sh` - Stop both nodes ## Testing with Simulator @@ -99,12 +99,12 @@ go build . The scripts use the following defaults: -### evmd Configuration +### ogd Configuration -- Container name: `evmd-jsonrpc-test` +- Container name: `ogd-jsonrpc-test` - Chain ID: `local-4221` - Validator count: 1 -- Data directory: `tests/jsonrpc/.evmd` +- Data directory: `tests/jsonrpc/.ogd` ### geth Configuration @@ -116,11 +116,11 @@ The scripts use the following defaults: ### Container fails to start -- Check if the Docker image was built: `docker images | grep cosmos/evmd` -- Check container logs: `docker logs evmd-jsonrpc-test` +- Check if the Docker image was built: `docker images | grep cosmos/ogd` +- Check container logs: `docker logs ogd-jsonrpc-test` ### JSON-RPC not responding -- Verify the container is running: `docker ps | grep evmd-jsonrpc-test` -- Check if ports are bound: `docker port evmd-jsonrpc-test` +- Verify the container is running: `docker ps | grep ogd-jsonrpc-test` +- Check if ports are bound: `docker port ogd-jsonrpc-test` - Test with curl: `curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' http://localhost:8545` diff --git a/tests/jsonrpc/docker-compose.yml b/tests/jsonrpc/docker-compose.yml index 314b3747..57b8cadd 100644 --- a/tests/jsonrpc/docker-compose.yml +++ b/tests/jsonrpc/docker-compose.yml @@ -1,16 +1,16 @@ version: "3" services: - evmd: - container_name: evmd-compat-test - image: "cosmos/evmd" + ogd: + container_name: ogd-compat-test + image: "cosmos/ogd" privileged: true user: root environment: - DEBUG=0 - ID=0 - - LOG=${LOG:-evmd.log} - - EVMDHOME=/data/node0/evmd + - LOG=${LOG:-ogd.log} + - OGDHOME=/data/node0/ogd cap_add: - SYS_PTRACE security_opt: @@ -19,12 +19,12 @@ services: - "8545:8545" - "8546:8546" volumes: - - ./.evmd:/data:Z - - ./scripts/evmd/container-start-evmd.sh:/container-start-evmd.sh:ro + - ./.ogd:/data:Z + - ./scripts/ogd/container-start-ogd.sh:/container-start-ogd.sh:ro networks: - jsonrpc-test entrypoint: ["/bin/sh", "-c"] - command: ["/container-start-evmd.sh"] + command: ["/container-start-ogd.sh"] healthcheck: test: ["CMD", "sh", "-c", "wget --no-verbose --tries=1 --timeout=5 --post-data='{\"jsonrpc\":\"2.0\",\"method\":\"eth_chainId\",\"params\":[],\"id\":1}' --header='Content-Type: application/json' -O- http://localhost:8545 | grep -q result || exit 1"] interval: 10s @@ -72,7 +72,7 @@ services: context: ../../ dockerfile: tests/jsonrpc/Dockerfile depends_on: - evmd: + ogd: condition: service_healthy geth: condition: service_healthy @@ -80,8 +80,8 @@ services: networks: - jsonrpc-test environment: - - EVMD_URL=http://evmd:8545 - - EVMD_WS_URL=ws://evmd:8546 + - ogd_URL=http://ogd:8545 + - ogd_WS_URL=ws://ogd:8546 - GETH_URL=http://geth:8545 - GETH_WS_URL=ws://geth:8546 volumes: From 137af05690b2fd2bcdb78cb262da6274a95b8f4f Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Thu, 12 Mar 2026 12:15:58 +0100 Subject: [PATCH 06/12] refactor: complete ogd rename - documentation, configs, and tests Changes: - evmd/app.go: Change appName constant from 'evmd' to 'ogd' - evmd/README.md: Update binary name in configuration table Documentation updates: - precompiles/slashing: Update .evmd -> .ogd paths in docs and code - precompiles/staking: Update CLI example (evmd -> ogd comet) - tests/systemtests: Update README with ogd binary references - tests/solidity: Update test helper messages and path references - client/debug: Update example command chain-id nces Build/deployment updates: - .github/workflows/aws-deploy.yml: Update Dockerfile path to ogd-env - evmd/tests/network/util.go: Update node directory path - tests/systemtests/chainupgrade: Update comment reference --- .github/workflows/aws-deploy.yml | 2 +- client/debug/debug.go | 2 +- contrib/images/{evmd-env => ogd-env}/Dockerfile | 0 contrib/images/{evmd-env => ogd-env}/wrapper.sh | 0 evmd/README.md | 2 +- evmd/app.go | 2 +- evmd/tests/network/util.go | 2 +- precompiles/slashing/README.md | 2 +- precompiles/slashing/query.go | 2 +- precompiles/staking/types.go | 2 +- .../suites/precompiles/test/5_slashing/queries.js | 2 +- tests/solidity/test-helper.js | 8 ++++---- tests/systemtests/README.md | 8 ++++---- tests/systemtests/chainupgrade/v4_v5.go | 4 ++-- 14 files changed, 19 insertions(+), 19 deletions(-) rename contrib/images/{evmd-env => ogd-env}/Dockerfile (100%) rename contrib/images/{evmd-env => ogd-env}/wrapper.sh (100%) diff --git a/.github/workflows/aws-deploy.yml b/.github/workflows/aws-deploy.yml index c4e35e7e..748c7657 100644 --- a/.github/workflows/aws-deploy.yml +++ b/.github/workflows/aws-deploy.yml @@ -42,6 +42,6 @@ jobs: env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} run: | - docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . -f ./contrib/images/evmd-env/Dockerfile + docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . -f ./contrib/images/ogd-env/Dockerfile docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG echo "Image pushed: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" diff --git a/client/debug/debug.go b/client/debug/debug.go index 62faedda..4a6131da 100644 --- a/client/debug/debug.go +++ b/client/debug/debug.go @@ -166,7 +166,7 @@ func LegacyEIP712Cmd() *cobra.Command { return &cobra.Command{ Use: "legacy-eip712 [file] [evm-chain-id]", Short: "Output types of legacy eip712 typed data according to the given transaction", - Example: fmt.Sprintf(`$ %s debug legacy-eip712 tx.json 4221 --chain-id evmd-1`, version.AppName), + Example: fmt.Sprintf(`$ %s debug legacy-eip712 tx.json 4221 --chain-id ogd-1`, version.AppName), Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) error { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/contrib/images/evmd-env/Dockerfile b/contrib/images/ogd-env/Dockerfile similarity index 100% rename from contrib/images/evmd-env/Dockerfile rename to contrib/images/ogd-env/Dockerfile diff --git a/contrib/images/evmd-env/wrapper.sh b/contrib/images/ogd-env/wrapper.sh similarity index 100% rename from contrib/images/evmd-env/wrapper.sh rename to contrib/images/ogd-env/wrapper.sh diff --git a/evmd/README.md b/evmd/README.md index 419b8aa5..f1c6d87e 100644 --- a/evmd/README.md +++ b/evmd/README.md @@ -14,7 +14,7 @@ By default, this chain has the following configuration: | Option | Value | |---------------------|------------------------| -| Binary | `evmd` | +| Binary | `ogd` | | Chain ID | `cosmos_262144-1` | | Custom Opcodes | - | | Default Token Pairs | 1 for the native token | diff --git a/evmd/app.go b/evmd/app.go index b92e46e5..d88e0393 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -136,7 +136,7 @@ func init() { defaultNodeHome = evmconfig.MustGetDefaultNodeHome() } -const appName = "evmd" +const appName = "ogd" // defaultNodeHome default home directories for the application daemon var defaultNodeHome string diff --git a/evmd/tests/network/util.go b/evmd/tests/network/util.go index d24769d4..37ce99f5 100644 --- a/evmd/tests/network/util.go +++ b/evmd/tests/network/util.go @@ -162,7 +162,7 @@ func collectGenFiles(cfg Config, vals []*Validator, outputDir string) error { for i := 0; i < cfg.NumValidators; i++ { cmtCfg := vals[i].Ctx.Config - nodeDir := filepath.Join(outputDir, vals[i].Moniker, "evmd") + nodeDir := filepath.Join(outputDir, vals[i].Moniker, "ogd") gentxsDir := filepath.Join(outputDir, "gentxs") cmtCfg.Moniker = vals[i].Moniker diff --git a/precompiles/slashing/README.md b/precompiles/slashing/README.md index 664f3cca..17a1c9c6 100644 --- a/precompiles/slashing/README.md +++ b/precompiles/slashing/README.md @@ -176,7 +176,7 @@ The precompile uses different address types: Consensus addresses are typically found in: -- `$HOME/.evmd/config/priv_validator_key.json` +- `$HOME/.ogd/config/priv_validator_key.json` - Validator info queries ## Integration Notes diff --git a/precompiles/slashing/query.go b/precompiles/slashing/query.go index 27eb630b..7bed881a 100644 --- a/precompiles/slashing/query.go +++ b/precompiles/slashing/query.go @@ -20,7 +20,7 @@ const ( // GetSigningInfo handles the `getSigningInfo` precompile call. // It expects a single argument: the validator’s consensus address in hex format. // That address comes from the validator’s CometBFT ed25519 public key, -// typically found in `$HOME/.evmd/config/priv_validator_key.json`. +// typically found in `$HOME/.ogd/config/priv_validator_key.json`. func (p *Precompile) GetSigningInfo( ctx sdk.Context, method *abi.Method, diff --git a/precompiles/staking/types.go b/precompiles/staking/types.go index 7c8baae5..7922d3e5 100644 --- a/precompiles/staking/types.go +++ b/precompiles/staking/types.go @@ -130,7 +130,7 @@ func NewMsgCreateValidator(args []interface{}, denom string, addrCdc address.Cod return nil, common.Address{}, fmt.Errorf(cmn.ErrInvalidValidator, args[3]) } - // use cli `evmd comet show-validator` get pubkey + // use cli `ogd comet show-validator` get pubkey pubkeyBase64Str, ok := args[4].(string) if !ok { return nil, common.Address{}, fmt.Errorf(cmn.ErrInvalidType, "pubkey", "string", args[4]) diff --git a/tests/solidity/suites/precompiles/test/5_slashing/queries.js b/tests/solidity/suites/precompiles/test/5_slashing/queries.js index 5ca4342e..fe93f300 100644 --- a/tests/solidity/suites/precompiles/test/5_slashing/queries.js +++ b/tests/solidity/suites/precompiles/test/5_slashing/queries.js @@ -3,7 +3,7 @@ const hre = require('hardhat'); describe('Slashing – query methods', function () { const SLASHING_ADDRESS = '0x0000000000000000000000000000000000000806'; - const CONS_ADDR = '0x020a0f48a2f4ce0f0cA6debF71DB83474dD717D0' // address derived from ed25519 pubkey which is placed in ~/.evmd/config/priv_validator_key.json + const CONS_ADDR = '0x020a0f48a2f4ce0f0cA6debF71DB83474dD717D0' // address derived from ed25519 pubkey which is placed in ~/.ogd/config/priv_validator_key.json let slashing; before(async function () { diff --git a/tests/solidity/test-helper.js b/tests/solidity/test-helper.js index 01c12917..0b644ac0 100644 --- a/tests/solidity/test-helper.js +++ b/tests/solidity/test-helper.js @@ -147,7 +147,7 @@ function checkTestEnv () { ) .describe('allowTests', 'only run specified tests. Separated by comma.') .boolean('verbose-log') - .describe('verbose-log', 'print evmd output, default false').argv + .describe('verbose-log', 'print ogd output, default false').argv if (!fs.existsSync(path.join(__dirname, './node_modules'))) { panic( @@ -311,7 +311,7 @@ function setupNetwork ({ runConfig, timeout }) { const spawnPromise = new Promise((resolve, reject) => { const serverStartedLog = 'Starting JSON-RPC server' - const serverStartedMsg = 'evmd started' + const serverStartedMsg = 'ogd started' const rootDir = path.resolve(__dirname, '..', '..'); // → ".../evm" const scriptPath = path.join(rootDir, 'local_node.sh'); // → ".../evm/local_node.sh" @@ -321,7 +321,7 @@ function setupNetwork ({ runConfig, timeout }) { stdio: ['ignore', 'pipe', 'pipe'], // <-- stdout/stderr streams }) - logger.info(`Starting evmd process... timeout: ${timeout}ms`) + logger.info(`Starting ogd process... timeout: ${timeout}ms`) if (runConfig.verboseLog) { osdProc.stdout.pipe(process.stdout) osdProc.stderr.pipe(process.stderr) @@ -354,7 +354,7 @@ function setupNetwork ({ runConfig, timeout }) { }) const timeoutPromise = new Promise((resolve, reject) => { - setTimeout(() => reject(new Error('Start evmd timeout!')), timeout) + setTimeout(() => reject(new Error('Start ogd timeout!')), timeout) }) return Promise.race([spawnPromise, timeoutPromise]) } diff --git a/tests/systemtests/README.md b/tests/systemtests/README.md index cc44bb20..e9ad70b6 100644 --- a/tests/systemtests/README.md +++ b/tests/systemtests/README.md @@ -2,7 +2,7 @@ ## Overview -The systemtests suite is an end-to-end test suite that runs the evmd process and sends RPC requests from separate Ethereum/Cosmos clients. The systemtests for cosmos/evm use the `cosmossdk.io/systemtests` package by default. For more details, please refer to https://github.com/cosmos/cosmos-sdk/tree/main/tests/systemtests. +The systemtests suite is an end-to-end test suite that runs the ogd process and sends RPC requests from separate Ethereum/Cosmos clients. The systemtests for cosmos/evm use the `cosmossdk.io/systemtests` package by default. For more details, please refer to https://github.com/cosmos/cosmos-sdk/tree/main/tests/systemtests. ## Preparation @@ -17,8 +17,8 @@ Or via manual steps ```shell make build mkdir -= ./tests/systemtests/binaries -cp ./build/evmd ./tests/systemtests/binaries -cp ./build/evmd ./tests/systemtests/binaries/v0.4 +cp ./build/ogd ./tests/systemtests/binaries +cp ./build/ogd ./tests/systemtests/binaries/v0.4 ``` ## Run Individual test @@ -28,7 +28,7 @@ Each scenario now has its own `Test…` wrapper in `main_test.go`, so you can ta ```shell cd tests/systemtests go test -failfast -mod=readonly -tags=system_test ./... -run TestMempoolTxsOrdering \ - --verbose --binary evmd --block-time 3s --chain-id local-4221 + --verbose --binary ogd --block-time 3s --chain-id local-4221 ``` Mempool scenarios: diff --git a/tests/systemtests/chainupgrade/v4_v5.go b/tests/systemtests/chainupgrade/v4_v5.go index 5dd0ba55..d1db96c9 100644 --- a/tests/systemtests/chainupgrade/v4_v5.go +++ b/tests/systemtests/chainupgrade/v4_v5.go @@ -18,7 +18,7 @@ import ( const ( upgradeHeight int64 = 12 - upgradeName = "v0.5.0-to-v0.6.0" // must match UpgradeName in evmd/upgrades.go + upgradeName = "v0.5.0-to-v0.6.0" // must match UpgradeName in ogd/upgrades.go ) // RunChainUpgrade exercises an on-chain software upgrade using the injected shared suite. @@ -37,7 +37,7 @@ func RunChainUpgrade(t *testing.T, base *suite.BaseTestSuite) { currentBranchBinary := sut.ExecBinary() currentInitializer := sut.TestnetInitializer() - legacyBinary := systest.WorkDir + "/binaries/v0.5/evmd" + legacyBinary := systest.WorkDir + "/binaries/v0.5/ogd" sut.SetExecBinary(legacyBinary) sut.SetTestnetInitializer(systest.InitializerWithBinary(legacyBinary, sut)) sut.SetupChain() From a0de916f94157ccabdcb64b65426197f5dc68638 Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Thu, 12 Mar 2026 13:05:04 +0100 Subject: [PATCH 07/12] refactoring makefile updates --- Makefile | 4 ++-- contrib/images/Makefile | 12 ++++++------ contrib/images/ogd-env/Dockerfile | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 6813dbba..8ee151bc 100644 --- a/Makefile +++ b/Makefile @@ -362,10 +362,10 @@ contracts-add: ############################################################################### localnet-build-env: - $(MAKE) -C contrib/images evmd-env + $(MAKE) -C contrib/images ogd-env localnet-build-nodes: - $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmos/evmd \ + $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmos/ogd \ testnet init-files --validator-count 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test --chain-id=local-4221 --use-docker=true docker compose up -d diff --git a/contrib/images/Makefile b/contrib/images/Makefile index 84601fa9..750c4a8b 100644 --- a/contrib/images/Makefile +++ b/contrib/images/Makefile @@ -1,10 +1,10 @@ -all: evmd-env +all: ogd-env -evmd-env: evmd-rmi - docker build --tag cosmos/evmd -f evmd-env/Dockerfile \ +ogd-env: ogd-rmi + docker build --tag cosmos/ogd -f ogd-env/Dockerfile \ $(shell git rev-parse --show-toplevel) -evmd-rmi: - docker rmi cosmos/evmd 2>/dev/null; true +ogd-rmi: + docker rmi cosmos/ogd 2>/dev/null; true -.PHONY: all evmd-env evmd-rmi +.PHONY: all ogd-env ogd-rmi diff --git a/contrib/images/ogd-env/Dockerfile b/contrib/images/ogd-env/Dockerfile index 8840ca65..7d88643a 100644 --- a/contrib/images/ogd-env/Dockerfile +++ b/contrib/images/ogd-env/Dockerfile @@ -25,10 +25,10 @@ RUN adduser -D nonroot -u 1025 -G nonroot EXPOSE 26656 26657 1317 9090 26660 8545 8100 STOPSIGNAL SIGTERM VOLUME /evmd -WORKDIR /evmd +WORKDIR /ogd # Copy the wrapper script and binary to expected locations -COPY contrib/images/evmd-env/wrapper.sh /usr/bin/wrapper.sh +COPY contrib/images/ogd-env/wrapper.sh /usr/bin/wrapper.sh COPY test_deployment.sh /usr/bin/test_deployment.sh COPY multi_node_startup.sh /usr/bin/multi_node_startup.sh COPY --from=evmd-builder /work/build/evmd /evmd/ From b644b08ddbf9f96f036cefd1ed60f93be72b9681 Mon Sep 17 00:00:00 2001 From: "khalifa.toumi" Date: Fri, 13 Mar 2026 11:25:05 +0100 Subject: [PATCH 08/12] keep evmd for v5.0 upgrade --- Makefile | 2 +- tests/jsonrpc/docker-compose.yml | 4 ++-- tests/jsonrpc/simulator/config/config.go | 4 ++-- tests/systemtests/chainupgrade/v4_v5.go | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 8ee151bc..3c048fc9 100644 --- a/Makefile +++ b/Makefile @@ -395,7 +395,7 @@ build-v05: mkdir -p ./tests/systemtests/binaries/v0.5 git checkout v0.5.0 make build - cp $(BUILDDIR)/$(EXAMPLE_BINARY) ./tests/systemtests/binaries/v0.5 + cp $(BUILDDIR)/evmd ./tests/systemtests/binaries/v0.5 git checkout - mocks: diff --git a/tests/jsonrpc/docker-compose.yml b/tests/jsonrpc/docker-compose.yml index 57b8cadd..672d44d7 100644 --- a/tests/jsonrpc/docker-compose.yml +++ b/tests/jsonrpc/docker-compose.yml @@ -80,8 +80,8 @@ services: networks: - jsonrpc-test environment: - - ogd_URL=http://ogd:8545 - - ogd_WS_URL=ws://ogd:8546 + - OGD_URL=http://ogd:8545 + - OGD_WS_URL=ws://ogd:8546 - GETH_URL=http://geth:8545 - GETH_WS_URL=ws://geth:8546 volumes: diff --git a/tests/jsonrpc/simulator/config/config.go b/tests/jsonrpc/simulator/config/config.go index 694ac5ed..09462743 100644 --- a/tests/jsonrpc/simulator/config/config.go +++ b/tests/jsonrpc/simulator/config/config.go @@ -60,7 +60,7 @@ func (c *Config) Validate() error { func MustLoadConfig() *Config { // Use environment variable if set, otherwise default to localhost - evmdURL := os.Getenv("EVMD_URL") + evmdURL := os.Getenv("OGD_URL") if evmdURL == "" { evmdURL = EvmdHttpEndpoint } @@ -71,7 +71,7 @@ func MustLoadConfig() *Config { } // Handle WebSocket URLs - derive from HTTP URLs or use environment variables - evmdWsURL := os.Getenv("EVMD_WS_URL") + evmdWsURL := os.Getenv("OGD_WS_URL") if evmdWsURL == "" { evmdWsURL = EvmdWsEndpoint } diff --git a/tests/systemtests/chainupgrade/v4_v5.go b/tests/systemtests/chainupgrade/v4_v5.go index d1db96c9..05be9812 100644 --- a/tests/systemtests/chainupgrade/v4_v5.go +++ b/tests/systemtests/chainupgrade/v4_v5.go @@ -37,7 +37,7 @@ func RunChainUpgrade(t *testing.T, base *suite.BaseTestSuite) { currentBranchBinary := sut.ExecBinary() currentInitializer := sut.TestnetInitializer() - legacyBinary := systest.WorkDir + "/binaries/v0.5/ogd" + legacyBinary := systest.WorkDir + "/binaries/v0.5/evmd" sut.SetExecBinary(legacyBinary) sut.SetTestnetInitializer(systest.InitializerWithBinary(legacyBinary, sut)) sut.SetupChain() From c1a7f39b4f14cffc3e30134c6ce5dd87eaf870ed Mon Sep 17 00:00:00 2001 From: Nikhil Sharma Date: Thu, 12 Mar 2026 14:02:14 +0530 Subject: [PATCH 09/12] feat(poa): integrate PoA module for gov-only validator set Signed-off-by: Nikhil Sharma --- ante/cosmos.go | 2 ++ evmd/app.go | 44 +++++++++++++++++++++++++++++++++++++- evmd/config/permissions.go | 2 ++ evmd/go.mod | 11 ++++++---- evmd/go.sum | 14 ++++++------ go.mod | 6 ++++-- go.sum | 14 ++++++------ 7 files changed, 74 insertions(+), 19 deletions(-) diff --git a/ante/cosmos.go b/ante/cosmos.go index a83be204..ea014d12 100644 --- a/ante/cosmos.go +++ b/ante/cosmos.go @@ -5,6 +5,7 @@ import ( evmante "github.com/cosmos/evm/ante/evm" evmtypes "github.com/cosmos/evm/x/vm/types" ibcante "github.com/cosmos/ibc-go/v10/modules/core/ante" + poaante "github.com/xrplevm/node/v10/x/poa/ante" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -40,5 +41,6 @@ func newCosmosAnteHandler(ctx sdk.Context, options HandlerOptions) sdk.AnteHandl ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), ante.NewIncrementSequenceDecorator(options.AccountKeeper), ibcante.NewRedundantRelayDecorator(options.IBCKeeper), + poaante.NewPoaDecorator(), ) } diff --git a/evmd/app.go b/evmd/app.go index d88e0393..83167ba4 100644 --- a/evmd/app.go +++ b/evmd/app.go @@ -121,12 +121,17 @@ import ( "github.com/cosmos/cosmos-sdk/x/mint" mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/slashing" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/xrplevm/node/v10/x/poa" + poakeeper "github.com/xrplevm/node/v10/x/poa/keeper" + poatypes "github.com/xrplevm/node/v10/x/poa/types" ) func init() { @@ -160,6 +165,7 @@ type EVMD struct { // keys to access the substores keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey oKeys map[string]*storetypes.ObjectStoreKey // keepers @@ -175,6 +181,8 @@ type EVMD struct { EvidenceKeeper evidencekeeper.Keeper FeeGrantKeeper feegrantkeeper.Keeper ConsensusParamsKeeper consensusparamkeeper.Keeper + ParamsKeeper paramskeeper.Keeper + PoaKeeper poakeeper.Keeper // IBC keepers IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly @@ -233,12 +241,14 @@ func NewExampleApp( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, minttypes.StoreKey, distrtypes.StoreKey, slashingtypes.StoreKey, govtypes.StoreKey, consensusparamtypes.StoreKey, + paramstypes.StoreKey, upgradetypes.StoreKey, feegrant.StoreKey, evidencetypes.StoreKey, authzkeeper.StoreKey, // ibc keys ibcexported.StoreKey, ibctransfertypes.StoreKey, // Cosmos EVM store keys evmtypes.StoreKey, feemarkettypes.StoreKey, erc20types.StoreKey, precisebanktypes.StoreKey, ) + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) oKeys := storetypes.NewObjectStoreKeys(banktypes.ObjectStoreKey, evmtypes.ObjectKey) var nonTransientKeys []storetypes.StoreKey @@ -267,10 +277,20 @@ func NewExampleApp( txConfig: txConfig, interfaceRegistry: interfaceRegistry, keys: keys, + tkeys: tkeys, oKeys: oKeys, } - // removed x/params: no ParamsKeeper initialization + // params keeper is used by the PoA module + // it is deprecated in the SDK but still required for the xrplevm/node PoA keeper + app.ParamsKeeper = paramskeeper.NewKeeper( + appCodec, + legacyAmino, + keys[paramstypes.StoreKey], + tkeys[paramstypes.TStoreKey], + ) + // Register subspace for PoA so GetSubspace(poatypes.ModuleName) returns a valid subspace. + app.ParamsKeeper.Subspace(poatypes.ModuleName).WithKeyTable(poatypes.ParamKeyTable()) // get authority address authAddr := authtypes.NewModuleAddress(govtypes.ModuleName).String() @@ -550,6 +570,15 @@ func NewExampleApp( tmLightClientModule := ibctm.NewLightClientModule(appCodec, storeProvider) clientKeeper.AddRoute(ibctm.ModuleName, &tmLightClientModule) + app.PoaKeeper = *poakeeper.NewKeeper( + appCodec, + app.GetSubspace(poatypes.ModuleName), + app.MsgServiceRouter(), + app.BankKeeper, + app.StakingKeeper, + authAddr, + ) + // Override the ICS20 app module transferModule := transfer.NewAppModule(app.TransferKeeper) @@ -570,6 +599,7 @@ func NewExampleApp( slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil, app.interfaceRegistry), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, nil), staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, nil), + poa.NewAppModule(appCodec, app.PoaKeeper, app.BankKeeper, app.StakingKeeper, app.AccountKeeper, app.interfaceRegistry), upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), @@ -641,6 +671,7 @@ func NewExampleApp( banktypes.ModuleName, govtypes.ModuleName, stakingtypes.ModuleName, + poatypes.ModuleName, authtypes.ModuleName, // Cosmos EVM EndBlockers @@ -662,6 +693,7 @@ func NewExampleApp( genesisModuleOrder := []string{ authtypes.ModuleName, banktypes.ModuleName, distrtypes.ModuleName, stakingtypes.ModuleName, slashingtypes.ModuleName, govtypes.ModuleName, + poatypes.ModuleName, minttypes.ModuleName, ibcexported.ModuleName, @@ -718,6 +750,7 @@ func NewExampleApp( // initialize stores app.MountKVStores(keys) app.MountObjectStores(oKeys) + app.MountTransientStores(tkeys) maxGasWanted := cast.ToUint64(appOpts.Get(srvflags.EVMMaxTxGasWanted)) @@ -918,6 +951,15 @@ func (app *EVMD) GetKey(storeKey string) *storetypes.KVStoreKey { return app.keys[storeKey] } +// GetSubspace returns a params subspace for a given module name. +func (app *EVMD) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, ok := app.ParamsKeeper.GetSubspace(moduleName) + if !ok { + panic(fmt.Sprintf("subspace for module %s not registered", moduleName)) + } + return subspace +} + // SimulationManager implements the SimulationApp interface func (app *EVMD) SimulationManager() *module.SimulationManager { return app.sm diff --git a/evmd/config/permissions.go b/evmd/config/permissions.go index 2aa0d5fa..79a3120a 100644 --- a/evmd/config/permissions.go +++ b/evmd/config/permissions.go @@ -15,6 +15,7 @@ import ( precisebanktypes "github.com/cosmos/evm/x/precisebank/types" vmtypes "github.com/cosmos/evm/x/vm/types" transfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" + poatypes "github.com/xrplevm/node/v10/x/poa/types" corevm "github.com/ethereum/go-ethereum/core/vm" ) @@ -59,6 +60,7 @@ var maccPerms = map[string][]string{ stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, govtypes.ModuleName: {authtypes.Burner}, + poatypes.ModuleName: {authtypes.Minter, authtypes.Burner}, // Cosmos EVM modules vmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, diff --git a/evmd/go.mod b/evmd/go.mod index daa44827..5cccc0d6 100644 --- a/evmd/go.mod +++ b/evmd/go.mod @@ -5,7 +5,7 @@ go 1.25.5 require ( cosmossdk.io/api v0.9.2 cosmossdk.io/client/v2 v2.0.0-beta.7 - cosmossdk.io/core v0.11.3 + cosmossdk.io/core v0.12.0 cosmossdk.io/errors v1.0.2 cosmossdk.io/log v1.6.1 cosmossdk.io/math v1.5.3 @@ -17,9 +17,9 @@ require ( github.com/cometbft/cometbft v0.39.0-beta.2 github.com/cosmos/cosmos-db v1.1.3 github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20260106173710-fd8291796e71 - github.com/cosmos/evm v0.2.0 + github.com/cosmos/evm v0.6.0 github.com/cosmos/gogoproto v1.7.2 - github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251216200936-98a683ee20a3 + github.com/cosmos/ibc-go/v10 v10.3.1-0.20250909102629-ed3b125c7b6f github.com/ethereum/go-ethereum v1.16.7 github.com/onsi/ginkgo/v2 v2.23.4 github.com/onsi/gomega v1.38.0 @@ -28,6 +28,7 @@ require ( github.com/spf13/pflag v1.0.10 github.com/spf13/viper v1.21.0 github.com/stretchr/testify v1.11.1 + github.com/xrplevm/node/v10 v10.0.3 golang.org/x/sync v0.19.0 google.golang.org/grpc v1.78.0 ) @@ -119,7 +120,7 @@ require ( github.com/dgraph-io/badger/v4 v4.6.0 // indirect github.com/dgraph-io/ristretto/v2 v2.1.0 // indirect github.com/dlclark/regexp2 v1.7.0 // indirect - github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect github.com/ebitengine/purego v0.9.1 // indirect @@ -316,9 +317,11 @@ require ( ) replace ( + cosmossdk.io/core => cosmossdk.io/core v0.11.3 // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 github.com/cosmos/evm => ../ + github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251216200936-98a683ee20a3 // use Cosmos geth fork // branch: release/1.16 github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v1.16.2-cosmos-1 diff --git a/evmd/go.sum b/evmd/go.sum index f5747706..d303a32f 100644 --- a/evmd/go.sum +++ b/evmd/go.sum @@ -262,8 +262,8 @@ github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ= github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI= github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -348,8 +348,8 @@ github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6 github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 h1:+3HCtB74++ClLy8GgjUQYeC8R4ILzVcIe8+5edAJJnE= -github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -798,8 +798,8 @@ github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -1022,6 +1022,8 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/xrplevm/node/v10 v10.0.3 h1:t6E0j3Tn/lIJ6iqyVtMgEWUDlEike6KLsL31ZOpIm1k= +github.com/xrplevm/node/v10 v10.0.3/go.mod h1:1cB9zELDyCvc1gacxO0wrBjR2yfFoMjq2OEPFnGU5Ew= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= diff --git a/go.mod b/go.mod index dd6b00a2..69b8b6d9 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25.5 require ( cosmossdk.io/api v0.9.2 - cosmossdk.io/core v0.11.3 + cosmossdk.io/core v0.12.0 cosmossdk.io/errors v1.0.2 cosmossdk.io/log v1.6.1 cosmossdk.io/math v1.5.3 @@ -21,7 +21,7 @@ require ( github.com/cosmos/cosmos-sdk v0.54.0-rc.1.0.20260106173710-fd8291796e71 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.7.2 - github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251216200936-98a683ee20a3 + github.com/cosmos/ibc-go/v10 v10.3.1-0.20250909102629-ed3b125c7b6f github.com/cosmos/ledger-cosmos-go v1.0.0 github.com/creachadair/tomledit v0.0.28 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc @@ -47,6 +47,7 @@ require ( github.com/tidwall/gjson v1.18.0 github.com/tidwall/sjson v1.2.5 github.com/tyler-smith/go-bip39 v1.1.0 + github.com/xrplevm/node/v10 v10.0.3 github.com/zondax/hid v0.9.2 go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.64.0 go.opentelemetry.io/otel v1.39.0 @@ -312,6 +313,7 @@ require ( replace ( // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 + github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.0.0-beta.0.0.20251216200936-98a683ee20a3 // use Cosmos geth fork // branch: release/1.16 github.com/ethereum/go-ethereum => github.com/cosmos/go-ethereum v1.16.2-cosmos-1 diff --git a/go.sum b/go.sum index 44d1503f..bc056c44 100644 --- a/go.sum +++ b/go.sum @@ -26,8 +26,8 @@ cosmossdk.io/api v0.9.2 h1:9i9ptOBdmoIEVEVWLtYYHjxZonlF/aOVODLFaxpmNtg= cosmossdk.io/api v0.9.2/go.mod h1:CWt31nVohvoPMTlPv+mMNCtC0a7BqRdESjCsstHcTkU= cosmossdk.io/collections v1.3.1 h1:09e+DUId2brWsNOQ4nrk+bprVmMUaDH9xvtZkeqIjVw= cosmossdk.io/collections v1.3.1/go.mod h1:ynvkP0r5ruAjbmedE+vQ07MT6OtJ0ZIDKrtJHK7Q/4c= -cosmossdk.io/core v0.11.3 h1:mei+MVDJOwIjIniaKelE3jPDqShCc/F4LkNNHh+4yfo= -cosmossdk.io/core v0.11.3/go.mod h1:9rL4RE1uDt5AJ4Tg55sYyHWXA16VmpHgbe0PbJc6N2Y= +cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= +cosmossdk.io/core v0.12.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.2.1 h1:eD6FxkIjlVaNZT+dXTQuwQTKZrFZ4UrfCq1RKgzyhMw= cosmossdk.io/depinject v1.2.1/go.mod h1:lqQEycz0H2JXqvOgVwTsjEdMI0plswI7p6KX+MVqFOM= cosmossdk.io/errors v1.0.2 h1:wcYiJz08HThbWxd/L4jObeLaLySopyyuUFB5w4AGpCo= @@ -257,8 +257,8 @@ github.com/cometbft/cometbft-db v0.14.1 h1:SxoamPghqICBAIcGpleHbmoPqy+crij/++eZz github.com/cometbft/cometbft-db v0.14.1/go.mod h1:KHP1YghilyGV/xjD5DP3+2hyigWx0WTp9X+0Gnx0RxQ= github.com/consensys/gnark-crypto v0.18.1 h1:RyLV6UhPRoYYzaFnPQA4qK3DyuDgkTgskDdoGqFt3fI= github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx8ubaYfDROyp2Z8c= -github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= -github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= +github.com/containerd/continuity v0.4.3 h1:6HVkalIp+2u1ZLH1J/pYX2oBVXlJZvh1X1A7bEZ9Su8= +github.com/containerd/continuity v0.4.3/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd v0.0.0-20180511133405-39ca1b05acc7/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= @@ -779,8 +779,8 @@ github.com/onsi/gomega v1.38.0/go.mod h1:OcXcwId0b9QsE7Y49u+BTrL4IdKOBOKnD6VQNTJ github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= -github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= -github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= +github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= +github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -1002,6 +1002,8 @@ github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcY github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1/go.mod h1:Ohn+xnUBiLI6FVj/9LpzZWtj1/D6lUovWYBkxHVV3aM= +github.com/xrplevm/node/v10 v10.0.3 h1:t6E0j3Tn/lIJ6iqyVtMgEWUDlEike6KLsL31ZOpIm1k= +github.com/xrplevm/node/v10 v10.0.3/go.mod h1:1cB9zELDyCvc1gacxO0wrBjR2yfFoMjq2OEPFnGU5Ew= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= From efe26500195be4d29246b0ac30b29327665a2098 Mon Sep 17 00:00:00 2001 From: Nikhil Sharma Date: Thu, 12 Mar 2026 14:04:34 +0530 Subject: [PATCH 10/12] docs(poa): add POA add-validator-via-gov guide and example proposal JSON Signed-off-by: Nikhil Sharma --- evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md | 276 ++++++++++++++++++++++ evmd/docs/poa_add_validator_proposal.json | 25 ++ 2 files changed, 301 insertions(+) create mode 100644 evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md create mode 100644 evmd/docs/poa_add_validator_proposal.json diff --git a/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md b/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md new file mode 100644 index 00000000..70d4c171 --- /dev/null +++ b/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md @@ -0,0 +1,276 @@ +# Add a PoA Validator via Governance — Step by Step + +This guide walks through adding a new validator using the PoA module and governance. Use it when the E2E script is not suitable or you want to run each step manually. + +**Paths in this repo (from repo root):** + +- **This guide:** `evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md` +- **Example proposal (template):** `evmd/docs/poa_add_validator_proposal.json` — replace `authority`, `validator_address`, and `pubkey` with your values from Steps 1–2. + +--- + +## How PoA prevents direct validator changes + +Under PoA (Proof of Authority), **normal staking is disabled** so the validator set is controlled only by governance: + +- The PoA **ante decorator** rejects any Cosmos tx that contains: + - `MsgDelegate` + - `MsgUndelegate` + - `MsgBeginRedelegate` + - `MsgCancelUnbondingDelegation` +- So users **cannot** delegate, undelegate, redelegate, or cancel unbonding. The validator set and delegations cannot be changed through regular txs. +- **Adding a validator** is only possible via a **governance proposal** whose message is `MsgAddValidator` with **authority** = gov module. When the proposal passes, the PoA module mints initial stake and creates the validator; it does **not** use a user’s self-bond or delegation. + +So “direct” validator creation (e.g. a user sending create-validator with their own funds) is not the path here; the only supported path is **gov proposal → MsgAddValidator**. + +### How to test that PoA is active + +Before running the add-validator flow, you can confirm PoA is blocking delegation: + +1. **Delegate (should fail)** + With the chain running and keys/chain-id matching your setup (e.g. `--home ~/.og-evm-devnet --chain-id 10740 --keyring-backend test`): + + ```bash + VALIDATOR=$(evmd query staking validators --home ~/.og-evm-devnet -o json 2>/dev/null | sed -n '/^{/,$ p' | jq -r '.validators[0].operator_address') + evmd tx staking delegate "$VALIDATOR" 1000000ogwei --from dev0 --keyring-backend test --home ~/.og-evm-devnet --chain-id 10740 -y + ``` + + **Expected:** The tx is **rejected** with an error containing **`tx type not allowed`**. That indicates the PoA ante is active and delegation is blocked. + +2. **Optional — other Cosmos txs still work** + For example, a bank send should succeed; only the staking messages above are blocked. + +Once you’ve confirmed that, you can safely follow the steps below to add a validator via governance. + +--- + +**Prerequisites** + +- Chain is running (e.g. from repo root: `./local_node.sh -y`). +- All commands below use: `--home ~/.og-evm-devnet --chain-id 10740 --keyring-backend test`. +- `jq` is optional but helpful for parsing; otherwise copy values from the command output. + +--- + +## Step 1. Get the gov module address (authority) + +Run: + +```bash +evmd query auth module-account gov --home ~/.og-evm-devnet -o json +``` + +In the output, ignore any lines like `=== REGISTERING TEE PRECOMPILE ===`. Find the JSON object and copy **`account.value.address`** (e.g. `og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k`). This is the **authority** for the proposal message. + +With jq (only the JSON line is parsed; if your evmd prints extra lines, copy the JSON block to a file first or use the next command): + +```bash +evmd query auth module-account gov --home ~/.og-evm-devnet -o json 2>/dev/null | sed -n '/^{/,$ p' | jq -r '.account.value.address' +``` + +Save this as **GOV_AUTHORITY** for the proposal. + +--- + +## Step 2. Create the new validator account and consensus key + +### 2a. Validator account (bech32 address) + +Add a key that will be the new validator’s account. **Do not fund this address.** + +```bash +evmd keys add newvalidator --keyring-backend test --home ~/.og-evm-devnet --no-backup +``` + +From the output, copy the **address** (e.g. `og1...`). This is **validator_address** in the proposal. The account must have no balance, no existing validator, and no delegations/unbonding when the proposal runs. + +### 2b. Consensus pubkey (ed25519) + +The chain expects a **consensus** key (ed25519), not the account key. Generate it in a **temporary directory** (do not use the running node’s config): + +```bash +mkdir -p /tmp/poa-consensus-keys && cd /tmp/poa-consensus-keys +cometbft gen-validator +``` + +`cometbft gen-validator` prints JSON to stdout. Find the **`pub_key.value`** field (a base64 string). Example: + +```json +"pub_key": {"type": "tendermint/PubKeyEd25519", "value": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk="} +``` + +Copy the **base64 value** (e.g. `aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=`). You will use it in the proposal as the ed25519 pubkey. + +Optional: clean up the temp dir so no validator keys remain: + +```bash +rm -rf /tmp/poa-consensus-keys +``` + +--- + +## Step 3. Build the proposal JSON + +Create a file (e.g. `proposal.json`) with this structure, or copy and edit the repo example **`evmd/docs/poa_add_validator_proposal.json`**. Replace: + +- **authority** → gov module address from Step 1 +- **validator_address** → new validator account address from Step 2a +- **key** (inside pubkey) → base64 value from Step 2b + +```json +{ + "messages": [ + { + "@type": "/poa.MsgAddValidator", + "authority": "", + "validator_address": "", + "description": { + "moniker": "newvalidator", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "" + } + } + ], + "metadata": "Add PoA validator", + "deposit": "10000000ogwei", + "title": "Add validator", + "summary": "Add a second validator via PoA governance", + "expedited": false +} +``` + +Example with real-looking values: + +```json +{ + "messages": [ + { + "@type": "/poa.MsgAddValidator", + "authority": "og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k", + "validator_address": "og1xu4krmxl40ec0vlfx3lk38hkj0scw8z79ck225", + "description": { + "moniker": "newvalidator", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=" + } + } + ], + "metadata": "Add PoA validator", + "deposit": "10000000ogwei", + "title": "Add validator", + "summary": "Add a second validator via PoA governance", + "expedited": false +} +``` + +--- + +## Step 4. Submit the proposal + +Use **enough gas** (e.g. 500000) so the tx does not run out of gas. From repo root you can use the example file: + +```bash +evmd tx gov submit-proposal evmd/docs/poa_add_validator_proposal.json \ + --from dev0 \ + --gas-prices 3000ogwei \ + --gas 500000 \ + --home ~/.og-evm-devnet \ + --chain-id 10740 \ + -y \ + --keyring-backend test +``` + +Or use your own file (e.g. `proposal.json`) after replacing authority, validator_address, and pubkey: + +```bash +evmd tx gov submit-proposal proposal.json \ + --from dev0 \ + --gas-prices 3000ogwei \ + --gas 500000 \ + --home ~/.og-evm-devnet \ + --chain-id 10740 \ + -y \ + --keyring-backend test +``` + +Note the **proposal id** from the output (or list proposals): + +```bash +evmd query gov proposals --home ~/.og-evm-devnet -o json +``` + +Again, if output has non-JSON lines, use only the JSON part when parsing. The latest proposal’s `id` is the one you need. + +--- + +## Step 5. Vote + +Vote **soon** after the proposal enters the voting period (with `local_node.sh`, voting period is 30s). Use the key that has staking power (e.g. `mykey`): + +```bash +evmd tx gov vote yes \ + --from mykey \ + --gas-prices 3000ogwei \ + --gas 300000 \ + --home ~/.og-evm-devnet \ + --chain-id 10740 \ + -y \ + --keyring-backend test +``` + +Replace `` with the id from Step 4 (e.g. `1` or `2`). + +--- + +## Step 6. Wait and verify + +Wait for the voting period to end (e.g. 30–35 seconds with `local_node.sh`). Then check the proposal status: + +```bash +evmd query gov proposal --home ~/.og-evm-devnet +``` + +You should see **status: PROPOSAL_STATUS_PASSED**. + +List validators to confirm the new one is in the set: + +```bash +evmd query staking validators --home ~/.og-evm-devnet -o json +``` + +You should see **two** validators: the original and the new one (moniker e.g. `newvalidator`). + +--- + +## Troubleshooting + +| Issue | What to check | +|-------|----------------| +| jq parse error | evmd may print TEE/precompile lines before JSON. Use only the JSON part (e.g. copy from first `{` to last `}`) or use `sed -n '/^{/,$ p'` before piping to jq. | +| Submit out of gas | Use `--gas 500000` (or higher) on submit-proposal. | +| Vote: "inactive proposal" | Voting period (30s) ended before your vote was included. Submit a new proposal and vote immediately. | +| Execution fails | Ensure the new validator account has **no** balance, no existing validator, and no delegations/unbonding. | + +--- + +## Quick reference + +- **Gov authority:** `evmd query auth module-account gov --home ~/.og-evm-devnet -o json` → `account.value.address` +- **New validator address:** `evmd keys add newvalidator ...` → address in output +- **Consensus pubkey:** `cometbft gen-validator` in a temp dir → `pub_key.value` (base64) +- **Proposal:** One message `@type: /poa.MsgAddValidator` with authority, validator_address, description, pubkey; deposit `10000000ogwei` +- **Submit:** `evmd tx gov submit-proposal evmd/docs/poa_add_validator_proposal.json --from dev0 --gas 500000 ...` (from repo root; or use your own `proposal.json`) +- **Vote:** `evmd tx gov vote yes --from mykey ...` +- **Verify:** `evmd query staking validators --home ~/.og-evm-devnet` diff --git a/evmd/docs/poa_add_validator_proposal.json b/evmd/docs/poa_add_validator_proposal.json new file mode 100644 index 00000000..5b7ce72b --- /dev/null +++ b/evmd/docs/poa_add_validator_proposal.json @@ -0,0 +1,25 @@ +{ + "messages": [ + { + "@type": "/poa.MsgAddValidator", + "authority": "og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k", + "validator_address": "og1warvjhukk7th2xprz7mhfa48h32cfm9jw5dl0c", + "description": { + "moniker": "newvalidator", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=" + } + } + ], + "metadata": "Add PoA validator", + "deposit": "10000000ogwei", + "title": "Add validator", + "summary": "Add a second validator via PoA governance", + "expedited": false +} From 0684b3fa274c935fe36633a612afbd9204d2ebfe Mon Sep 17 00:00:00 2001 From: Yogesh Shahi Date: Sun, 15 Mar 2026 04:04:20 +0530 Subject: [PATCH 11/12] docs(poa): rewrite add-validator guide and update README --- evmd/README.md | 13 +- evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md | 267 ++++++++++------------ evmd/docs/poa_add_validator_proposal.json | 6 +- 3 files changed, 136 insertions(+), 150 deletions(-) diff --git a/evmd/README.md b/evmd/README.md index f1c6d87e..ef003dfd 100644 --- a/evmd/README.md +++ b/evmd/README.md @@ -14,11 +14,11 @@ By default, this chain has the following configuration: | Option | Value | |---------------------|------------------------| -| Binary | `ogd` | -| Chain ID | `cosmos_262144-1` | +| Binary | `ogd` | +| Chain ID | `10740` | | Custom Opcodes | - | | Default Token Pairs | 1 for the native token | -| Denomination | `atest` | +| Denomination | `ogwei` | | EVM permissioning | permissionless | | Enabled Precompiles | all | @@ -55,6 +55,12 @@ unhappy lunar seat` ![RPC URL Settings](guide/rpc_url.png "RPC URL") ![Overview of required settings](guide/settings.png "Settings Overview") +## Proof of Authority (PoA) + +Currently this is a PoA chain. The validator set is managed through governance, not open staking. Regular staking transactions like delegate and undelegate are blocked at the ante handler level. Validators can only be added or removed via governance proposals. The PoA module is built by the [xrplevm/node](https://github.com/xrplevm/node) team. + +See [evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md](docs/POA_ADD_VALIDATOR_VIA_GOV.md) for a step-by-step guide on adding a validator. + ## Available Cosmos SDK Modules As mentioned above, this exemplary chain implementation is a reduced version of `simapp`. @@ -72,6 +78,7 @@ Specifically, instead of offering access to all Cosmos SDK modules, it just incl - `gov` - `mint` - `params` +- `poa` - `slashing` - `staking` - `upgrade` diff --git a/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md b/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md index 70d4c171..8f51832d 100644 --- a/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md +++ b/evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md @@ -1,121 +1,127 @@ -# Add a PoA Validator via Governance — Step by Step +# Add a PoA Validator via Governance -This guide walks through adding a new validator using the PoA module and governance. Use it when the E2E script is not suitable or you want to run each step manually. +This guide walks you through adding a new validator using the PoA module and governance. The commands here are written for a local devnet. If you are setting this up on mainnet, the steps are the same but some values will differ. Check the [Notes for mainnet](#notes-for-mainnet) section at the end before you start. -**Paths in this repo (from repo root):** - -- **This guide:** `evmd/docs/POA_ADD_VALIDATOR_VIA_GOV.md` -- **Example proposal (template):** `evmd/docs/poa_add_validator_proposal.json` — replace `authority`, `validator_address`, and `pubkey` with your values from Steps 1–2. +Proposal template: `evmd/docs/poa_add_validator_proposal.json` (fill in your values from Steps 1 and 2) --- -## How PoA prevents direct validator changes - -Under PoA (Proof of Authority), **normal staking is disabled** so the validator set is controlled only by governance: +## How PoA works -- The PoA **ante decorator** rejects any Cosmos tx that contains: - - `MsgDelegate` - - `MsgUndelegate` - - `MsgBeginRedelegate` - - `MsgCancelUnbondingDelegation` -- So users **cannot** delegate, undelegate, redelegate, or cancel unbonding. The validator set and delegations cannot be changed through regular txs. -- **Adding a validator** is only possible via a **governance proposal** whose message is `MsgAddValidator` with **authority** = gov module. When the proposal passes, the PoA module mints initial stake and creates the validator; it does **not** use a user’s self-bond or delegation. +Under PoA (Proof of Authority), normal staking is disabled. The validator set is controlled only through governance. -So “direct” validator creation (e.g. a user sending create-validator with their own funds) is not the path here; the only supported path is **gov proposal → MsgAddValidator**. +The PoA ante decorator rejects any transaction that contains these message types: -### How to test that PoA is active +- `MsgDelegate` +- `MsgUndelegate` +- `MsgBeginRedelegate` +- `MsgCancelUnbondingDelegation` -Before running the add-validator flow, you can confirm PoA is blocking delegation: +This means nobody can delegate, undelegate, or redelegate through regular transactions. The only way to add a validator is through a governance proposal using `MsgAddValidator`. When the proposal passes, the PoA module mints the initial stake and creates the validator on its own. It does not rely on a user's self-bond or delegation. -1. **Delegate (should fail)** - With the chain running and keys/chain-id matching your setup (e.g. `--home ~/.og-evm-devnet --chain-id 10740 --keyring-backend test`): +--- - ```bash - VALIDATOR=$(evmd query staking validators --home ~/.og-evm-devnet -o json 2>/dev/null | sed -n '/^{/,$ p' | jq -r '.validators[0].operator_address') - evmd tx staking delegate "$VALIDATOR" 1000000ogwei --from dev0 --keyring-backend test --home ~/.og-evm-devnet --chain-id 10740 -y - ``` +## Prerequisites - **Expected:** The tx is **rejected** with an error containing **`tx type not allowed`**. That indicates the PoA ante is active and delegation is blocked. +- The chain is running. You can start it from the repo root with `./local_node.sh -y`. +- The examples in this guide use the devnet defaults: home directory `~/.og-evm-devnet`, chain ID `10740`, and the test keyring. Adjust these if your setup is different. See the "Notes for mainnet" section at the bottom for production differences. +- `jq` is helpful for parsing JSON output but not strictly required. +- `cometbft` CLI is needed for generating the consensus key in Step 2b. This guide was tested with cometbft v0.38.x. If you don't have it installed, follow the official install guide: https://docs.cometbft.com/v0.38/guides/install -2. **Optional — other Cosmos txs still work** - For example, a bank send should succeed; only the staking messages above are blocked. +### Quick check: is PoA active? -Once you’ve confirmed that, you can safely follow the steps below to add a validator via governance. +Before going through the full flow, you can verify that PoA is actually blocking delegation. Try sending a delegate transaction (it should fail): ---- +```bash +VALIDATOR=$(ogd query staking validators \ + --home ~/.og-evm-devnet -o json 2>/dev/null \ + | sed -n '/^{/,$ p' \ + | jq -r '.validators[0].operator_address') -**Prerequisites** +ogd tx staking delegate "$VALIDATOR" 1000000ogwei \ + --from dev0 \ + --keyring-backend test \ + --home ~/.og-evm-devnet \ + --chain-id 10740 \ + --gas-prices 300000ogwei \ + --gas 300000 \ + -y +``` -- Chain is running (e.g. from repo root: `./local_node.sh -y`). -- All commands below use: `--home ~/.og-evm-devnet --chain-id 10740 --keyring-backend test`. -- `jq` is optional but helpful for parsing; otherwise copy values from the command output. +You should see an error with `tx type not allowed`. That confirms the PoA ante decorator is working. Other transactions like bank sends will still go through normally. --- -## Step 1. Get the gov module address (authority) +## Step 1. Get the governance module address -Run: +Every governance proposal needs an `authority`, which is the address of the gov module. Query it like this: ```bash -evmd query auth module-account gov --home ~/.og-evm-devnet -o json +ogd query auth module-account gov \ + --home ~/.og-evm-devnet -o json 2>/dev/null \ + | sed -n '/^{/,$ p' \ + | jq -r '.account.value.address' ``` -In the output, ignore any lines like `=== REGISTERING TEE PRECOMPILE ===`. Find the JSON object and copy **`account.value.address`** (e.g. `og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k`). This is the **authority** for the proposal message. +You should get something like `og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k`. Save this value, you will need it as the `authority` field in the proposal JSON. -With jq (only the JSON line is parsed; if your evmd prints extra lines, copy the JSON block to a file first or use the next command): +> **Note:** `ogd` sometimes prints extra lines like `=== REGISTERING TEE PRECOMPILE ===` before the JSON. The `sed` command above filters those out. If you're not using jq, just look for the JSON block in the output and copy the address from `account.value.address`. -```bash -evmd query auth module-account gov --home ~/.og-evm-devnet -o json 2>/dev/null | sed -n '/^{/,$ p' | jq -r '.account.value.address' -``` +--- -Save this as **GOV_AUTHORITY** for the proposal. +## Step 2. Create the new validator's keys ---- +A validator in the Cosmos ecosystem needs two separate keys: -## Step 2. Create the new validator account and consensus key +- An **account key** (Step 2a): this is the validator's on-chain identity, a regular bech32 address. +- A **consensus key** (Step 2b): this is an ed25519 key that the validator uses to sign blocks. It is different from the account key. You will need this consensus key later in the proposal JSON. -### 2a. Validator account (bech32 address) +### 2a. Validator account -Add a key that will be the new validator’s account. **Do not fund this address.** +Create a new key for the validator. The PoA module expects a fresh account, so do not fund this address. If the address already has funds or an existing validator record, the proposal will fail. ```bash -evmd keys add newvalidator --keyring-backend test --home ~/.og-evm-devnet --no-backup +ogd keys add newvalidator \ + --keyring-backend test \ + --home ~/.og-evm-devnet \ + --no-backup ``` -From the output, copy the **address** (e.g. `og1...`). This is **validator_address** in the proposal. The account must have no balance, no existing validator, and no delegations/unbonding when the proposal runs. +> The `--no-backup` flag skips showing the mnemonic. This is fine for devnet/testing but you should back up the mnemonic for any real deployment. -### 2b. Consensus pubkey (ed25519) +Copy the `address` from the output (looks like `og1...`). This will be the `validator_address` in the proposal. -The chain expects a **consensus** key (ed25519), not the account key. Generate it in a **temporary directory** (do not use the running node’s config): +### 2b. Consensus key -```bash -mkdir -p /tmp/poa-consensus-keys && cd /tmp/poa-consensus-keys -cometbft gen-validator -``` +The consensus key is what the validator actually uses to participate in consensus and sign blocks. In Cosmos chains, this is always an ed25519 key, separate from the account key you created above. -`cometbft gen-validator` prints JSON to stdout. Find the **`pub_key.value`** field (a base64 string). Example: +Generate one using the `cometbft` CLI: -```json -"pub_key": {"type": "tendermint/PubKeyEd25519", "value": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk="} +```bash +cometbft gen-validator | jq -r '.Key.pub_key.value' ``` -Copy the **base64 value** (e.g. `aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=`). You will use it in the proposal as the ed25519 pubkey. +This prints just the consensus key value you need. Copy it. You will plug this into the proposal JSON in the next step. -Optional: clean up the temp dir so no validator keys remain: +> **Heads up:** Every time you run `cometbft gen-validator`, it generates a new key. If you run it again, you will get a different key. So copy the value the first time and save it somewhere. -```bash -rm -rf /tmp/poa-consensus-keys -``` +If you want to see the full output including the private key, run `cometbft gen-validator | jq '.'` instead. The consensus key is the `value` string inside `Key.pub_key`. + +> **Important:** In a production setup, the consensus key's private portion must be securely stored on the machine that will actually run the validator node. For this devnet walkthrough, you only need the public key for the proposal. --- ## Step 3. Build the proposal JSON -Create a file (e.g. `proposal.json`) with this structure, or copy and edit the repo example **`evmd/docs/poa_add_validator_proposal.json`**. Replace: +Now put together the governance proposal. You can either create a new file or copy and edit the template at `evmd/docs/poa_add_validator_proposal.json`. + +Fill in the three values you collected: + +- `authority`: the gov module address from Step 1 +- `validator_address`: the new validator's account address from Step 2a +- `key` (inside `pubkey`): the consensus key from Step 2b -- **authority** → gov module address from Step 1 -- **validator_address** → new validator account address from Step 2a -- **key** (inside pubkey) → base64 value from Step 2b +`moniker` is the validator's display name. The other description fields (`identity`, `website`, `security_contact`, `details`) are optional and can be left empty. ```json { @@ -133,7 +139,7 @@ Create a file (e.g. `proposal.json`) with this structure, or copy and edit the r }, "pubkey": { "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "" + "key": "" } } ], @@ -145,132 +151,105 @@ Create a file (e.g. `proposal.json`) with this structure, or copy and edit the r } ``` -Example with real-looking values: - -```json -{ - "messages": [ - { - "@type": "/poa.MsgAddValidator", - "authority": "og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k", - "validator_address": "og1xu4krmxl40ec0vlfx3lk38hkj0scw8z79ck225", - "description": { - "moniker": "newvalidator", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "pubkey": { - "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=" - } - } - ], - "metadata": "Add PoA validator", - "deposit": "10000000ogwei", - "title": "Add validator", - "summary": "Add a second validator via PoA governance", - "expedited": false -} -``` +Save this as `proposal.json` (or whatever name you prefer). --- ## Step 4. Submit the proposal -Use **enough gas** (e.g. 500000) so the tx does not run out of gas. From repo root you can use the example file: +Submit the proposal with enough gas. The chain uses EIP-1559 style fee pricing, so the base fee can rise over time. A gas price of `300000ogwei` works on devnet. For mainnet values, see the "Notes for mainnet" section below. ```bash -evmd tx gov submit-proposal evmd/docs/poa_add_validator_proposal.json \ +ogd tx gov submit-proposal proposal.json \ --from dev0 \ - --gas-prices 3000ogwei \ + --gas-prices 300000ogwei \ --gas 500000 \ --home ~/.og-evm-devnet \ --chain-id 10740 \ - -y \ - --keyring-backend test + --keyring-backend test \ + -y ``` -Or use your own file (e.g. `proposal.json`) after replacing authority, validator_address, and pubkey: +Note the proposal ID from the output. You can also list all proposals to find it: ```bash -evmd tx gov submit-proposal proposal.json \ - --from dev0 \ - --gas-prices 3000ogwei \ - --gas 500000 \ - --home ~/.og-evm-devnet \ - --chain-id 10740 \ - -y \ - --keyring-backend test +ogd query gov proposals \ + --home ~/.og-evm-devnet -o json 2>/dev/null \ + | sed -n '/^{/,$ p' \ + | jq '.proposals[-1].id' ``` -Note the **proposal id** from the output (or list proposals): - -```bash -evmd query gov proposals --home ~/.og-evm-devnet -o json -``` - -Again, if output has non-JSON lines, use only the JSON part when parsing. The latest proposal’s `id` is the one you need. - --- ## Step 5. Vote -Vote **soon** after the proposal enters the voting period (with `local_node.sh`, voting period is 30s). Use the key that has staking power (e.g. `mykey`): +Vote yes as soon as possible. With `local_node.sh`, the voting period is only 30 seconds, so you need to be quick. + +Use the key that has staking power (on the devnet, that's `mykey`, not `dev0`): ```bash -evmd tx gov vote yes \ +ogd tx gov vote yes \ --from mykey \ - --gas-prices 3000ogwei \ + --gas-prices 300000ogwei \ --gas 300000 \ --home ~/.og-evm-devnet \ --chain-id 10740 \ - -y \ - --keyring-backend test + --keyring-backend test \ + -y ``` -Replace `` with the id from Step 4 (e.g. `1` or `2`). +Replace `` with the ID from Step 4. + +> **Why `mykey` and not `dev0`?** Only accounts with staking power (existing validators or their delegators) can cast votes that count toward the tally. On the devnet, `mykey` is the initial validator's key. --- ## Step 6. Wait and verify -Wait for the voting period to end (e.g. 30–35 seconds with `local_node.sh`). Then check the proposal status: +Wait about 35 seconds for the voting period to end, then check the proposal status: ```bash -evmd query gov proposal --home ~/.og-evm-devnet +ogd query gov proposal --home ~/.og-evm-devnet ``` -You should see **status: PROPOSAL_STATUS_PASSED**. +You should see `status: PROPOSAL_STATUS_PASSED`. -List validators to confirm the new one is in the set: +Now list the validators: ```bash -evmd query staking validators --home ~/.og-evm-devnet -o json +ogd query staking validators --home ~/.og-evm-devnet -o json 2>/dev/null \ + | sed -n '/^{/,$ p' \ + | jq '[.validators[] | {moniker: .description.moniker, status: .status}]' ``` -You should see **two** validators: the original and the new one (moniker e.g. `newvalidator`). +You should see two validators: the original one and the new one (with moniker `newvalidator`). + +> **What happens next?** The validator is now registered on-chain, but for it to actually produce blocks, a node needs to be running with the matching consensus private key in its `config/priv_validator_key.json`. On devnet this does not matter since you are just testing the governance flow. --- ## Troubleshooting | Issue | What to check | -|-------|----------------| -| jq parse error | evmd may print TEE/precompile lines before JSON. Use only the JSON part (e.g. copy from first `{` to last `}`) or use `sed -n '/^{/,$ p'` before piping to jq. | -| Submit out of gas | Use `--gas 500000` (or higher) on submit-proposal. | -| Vote: "inactive proposal" | Voting period (30s) ended before your vote was included. Submit a new proposal and vote immediately. | -| Execution fails | Ensure the new validator account has **no** balance, no existing validator, and no delegations/unbonding. | +|-------|---------------| +| jq parse error | `ogd` sometimes prints TEE/precompile log lines before the JSON. Use `sed -n '/^{/,$ p'` to filter them out, or just copy the JSON block manually. | +| Submit fails with out of gas | Increase `--gas` (try 500000 or higher). | +| Submit fails with gas price too low | The EIP-1559 base fee rises over time. Increase `--gas-prices` (try 300000ogwei or higher). | +| Vote says "inactive proposal" | The 30s voting period ended before your vote landed. Submit a new proposal and vote right away. | +| Proposal execution fails | Make sure the new validator account has no balance, no existing validator record, and no delegations. | +| Key already exists | You already created a key with that name. Use `ogd keys delete newvalidator --keyring-backend test --home ~/.og-evm-devnet` or pick a different name. | --- -## Quick reference +## Notes for mainnet + +This guide is written for a local devnet. If you are doing this on mainnet, a few things will be different: -- **Gov authority:** `evmd query auth module-account gov --home ~/.og-evm-devnet -o json` → `account.value.address` -- **New validator address:** `evmd keys add newvalidator ...` → address in output -- **Consensus pubkey:** `cometbft gen-validator` in a temp dir → `pub_key.value` (base64) -- **Proposal:** One message `@type: /poa.MsgAddValidator` with authority, validator_address, description, pubkey; deposit `10000000ogwei` -- **Submit:** `evmd tx gov submit-proposal evmd/docs/poa_add_validator_proposal.json --from dev0 --gas 500000 ...` (from repo root; or use your own `proposal.json`) -- **Vote:** `evmd tx gov vote yes --from mykey ...` -- **Verify:** `evmd query staking validators --home ~/.og-evm-devnet` +- **Keyring backend.** You would not use `--keyring-backend test` on mainnet. Use `os` or `file` instead, and make sure you have the passphrase ready. The test backend stores keys unencrypted and is not safe for real funds. +- **Chain ID and home directory.** Replace `--chain-id 10740` and `--home ~/.og-evm-devnet` with your actual mainnet chain ID and node home directory. +- **Voting period.** On mainnet the voting period is much longer (days, not 30 seconds). You don't need to rush the vote. Coordinate with other validators to make sure the proposal reaches quorum. +- **Gas prices.** The base fee on mainnet will be different from devnet. Check current gas prices before submitting. You can use `ogd query feemarket base-fee` to see the current base fee. +- **Consensus key security.** On devnet we only care about the public key for the proposal. On mainnet, the private key must live on the validator machine in a secure location (typically `config/priv_validator_key.json`). Treat it like a password. If someone gets your consensus private key, they can double-sign on your behalf and get your validator slashed. +- **Validator account.** On mainnet, back up the mnemonic when creating the validator key. Do not use `--no-backup`. +- **Deposit amount.** The minimum deposit for a proposal may differ on mainnet. Check your chain's gov params with `ogd query gov params`. +- **Who submits and who votes.** On devnet we use `dev0` to submit and `mykey` to vote because that is how the local setup is configured. On mainnet, any funded account can submit a proposal, and all validators (or their delegators) with staking power can vote. diff --git a/evmd/docs/poa_add_validator_proposal.json b/evmd/docs/poa_add_validator_proposal.json index 5b7ce72b..372fcbb0 100644 --- a/evmd/docs/poa_add_validator_proposal.json +++ b/evmd/docs/poa_add_validator_proposal.json @@ -2,8 +2,8 @@ "messages": [ { "@type": "/poa.MsgAddValidator", - "authority": "og10d07y265gmmuvt4z0w9aw880jnsr700jrdya3k", - "validator_address": "og1warvjhukk7th2xprz7mhfa48h32cfm9jw5dl0c", + "authority": "", + "validator_address": "", "description": { "moniker": "newvalidator", "identity": "", @@ -13,7 +13,7 @@ }, "pubkey": { "@type": "/cosmos.crypto.ed25519.PubKey", - "key": "aHlSZw+054g3XnuDblDq6TafZrXVK7xGuk9081g1FAk=" + "key": "" } } ], From f22ea0f47c9ae2563a02c866586814f89e8e9c93 Mon Sep 17 00:00:00 2001 From: Yogesh Shahi Date: Sun, 15 Mar 2026 04:04:28 +0530 Subject: [PATCH 12/12] fix(docker): add entrypoint and start command to localnet nodes --- Makefile | 2 +- docker-compose.yml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 3c048fc9..3f580572 100644 --- a/Makefile +++ b/Makefile @@ -365,7 +365,7 @@ localnet-build-env: $(MAKE) -C contrib/images ogd-env localnet-build-nodes: - $(DOCKER) run --rm -v $(CURDIR)/.testnets:/data cosmos/ogd \ + $(DOCKER) run --rm --entrypoint ogd -v $(CURDIR)/.testnets:/data cosmos/ogd \ testnet init-files --validator-count 4 -o /data --starting-ip-address 192.168.10.2 --keyring-backend=test --chain-id=local-4221 --use-docker=true docker compose up -d diff --git a/docker-compose.yml b/docker-compose.yml index a02f9489..c8372325 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,6 +4,8 @@ services: evmdnode0: container_name: evmdnode0 image: "cosmos/evmd" + entrypoint: ["/usr/bin/wrapper.sh"] + command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"] environment: - DEBUG=0 - ID=0 @@ -28,6 +30,8 @@ services: evmdnode1: container_name: evmdnode1 image: "cosmos/evmd" + entrypoint: ["/usr/bin/wrapper.sh"] + command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"] environment: - DEBUG=0 - ID=1 @@ -52,6 +56,8 @@ services: evmdnode2: container_name: evmdnode2 image: "cosmos/evmd" + entrypoint: ["/usr/bin/wrapper.sh"] + command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"] environment: - DEBUG=0 - ID=2 @@ -76,6 +82,8 @@ services: evmdnode3: container_name: evmdnode3 image: "cosmos/evmd" + entrypoint: ["/usr/bin/wrapper.sh"] + command: ["start", "--chain-id", "local-4221", "--json-rpc.api", "eth,txpool,personal,net,debug,web3"] environment: - DEBUG=0 - ID=3