Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

feat(core): add EOA sender validation (EIP-3607) #4840

Open
wants to merge 13 commits into
base: feature/updated-mesage-struct-as-eth
Choose a base branch
from

Conversation

sunwavesun
Copy link

@sunwavesun sunwavesun commented Jan 31, 2025

Changes

  • Implemented core logic for EOA validation based on EIP-3607
  • Added unit tests to cover EOA validation and preCheck functionality

Cause

This update enhances security by preventing contract accounts from sending transactions directly, aligning with the EIP-3607 standard. It addresses inconsistencies in sender validation logic within the core module.

How to Test

  • Run make go-test to verify all unit tests pass
  • Run go test -run ^TestPreCheck$ github.com/harmony-one/harmony/core for the specific unit test

Sun Hyuk Ahn added 2 commits February 2, 2025 21:24
@sunwavesun sunwavesun changed the title EIP-3607 check if sender is EOA feat(core): add EOA sender validation (EIP-3607) Feb 2, 2025
@Frozen Frozen force-pushed the feature/updated-mesage-struct-as-eth branch from 16229ee to 47fa42a Compare February 4, 2025 23:44
@Frozen Frozen force-pushed the feature/updated-mesage-struct-as-eth branch from 47fa42a to a815eaf Compare February 7, 2025 00:01
@mur-me
Copy link
Collaborator

mur-me commented Feb 7, 2025

Hey @sunwavesun, I was checking rossetta tests for the #4840 and staking have been definitely broken inside it:

Steps to reproduce - repo name in square brackets:

  1. [harmony] - I've altered scripts/travis_rosetta_checker.sh to not to check out [harmony-test] repo:
# git fetch origin "${TEST_REPO_BRANCH}"
# git checkout "${TEST_REPO_BRANCH}"
# git pull --rebase=true
  1. [harmony-test] - change run.sh 102 line to the following, it will help to get the debug info:
  export ROSETTA_DEBUG=1 
  rosetta-cli check:construction --configuration-file "$DIR/../configs/localnet_rosetta_test_s0.json" > output_rossetta.log 2>&1 || error=1
  1. [harmony] - run make travis_rosetta_checker locally
  2. Check the output_rossetta.log and you will find following:
broadcast failed for job "staking (34)"
unable to add block 181 (block hash: 0x7027b9c2a0150946bf21b0e2a86f376563ff856ac534587b3949933a61fa8d96) to storage: unable to broadcast pending transactions: unable to handle broadcast failure for broadcast 34: broadcast failed for transaction 0xc557811f663a77e4c94cf2e5965df7bf87a9f26d10936eeffc850d460fa6ca30 with intent [
 {
  "operation_identifier": {
   "index": 0
  },
  "type": "EditValidator",
  "status": "",
  "account": {
   "address": "one155jp2y76nazx8uw5sa94fr0m4s5aj8e5xm6fu3",
   "metadata": {
    "hex_address": "0xA5241513DA9F4463F1d4874b548dFBAC29D91f34"
   }
  },
  "amount": {
   "value": "0",
   "currency": {
    "symbol": "ONE",
    "decimals": 18
   }
  },
  "metadata": {
   "commissionRate": 100000000000000000,
   "details": "Don't mess with me!!!",
   "identity": "alice",
   "maxTotalDelegation": 50000,
   "minSelfDelegation": 20000,
   "name": "Alice",
   "securityContact": "Bob",
   "validatorAddress": "one155jp2y76nazx8uw5sa94fr0m4s5aj8e5xm6fu3",
   "website": "alice.harmony.one"
  }
 }
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants