Skip to content

Add governance EVM direct call#573

Closed
m-Peter wants to merge 2 commits intomasterfrom
mpeter/add-governance-direct-call
Closed

Add governance EVM direct call#573
m-Peter wants to merge 2 commits intomasterfrom
mpeter/add-governance-direct-call

Conversation

@m-Peter
Copy link
Collaborator

@m-Peter m-Peter commented Dec 30, 2025

No description provided.

}
}

access(all)

Choose a reason for hiding this comment

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

This should not be access all in my view, should be only callable by the service account

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved it in the Administrator resource.

@m-Peter m-Peter force-pushed the mpeter/add-governance-direct-call branch from f8e8962 to 9631f2c Compare December 30, 2025 18:49

access(all)
fun governanceDirectCall(from: String, to: String, amount: UInt): EVM.Result {
return EVM.reclaimFundsFromAttackerEOAs(from: from, to: to, amount: amount)
Copy link
Member

Choose a reason for hiding this comment

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

Can this only reclaim FLOW? Don't we need to do this for other token types too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There's only FLOW sitting on the 2 EOA addresses. No other token type.

Copy link
Member

Choose a reason for hiding this comment

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

Okay, can you tag me in the PR for the EVM contract as well?

Copy link
Member

Choose a reason for hiding this comment

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

So if I am calling this from a transaction signed from the service account, it would look like this?

serviceAccountAdmin.governanceDirectCall(from: accountToRetrieveFrom, to: serviceAccountCOA.address().toString(), amount: amount)

accountToRetrieveFrom being in this format: "0x9D9247F5C3F3B78F7EE2C480B9CDaB91393Bf4D6"
and amount being in this format: 100000000000000000 for 10 FLOW

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For reference, the transaction I tried this with on a forked mainnet emulator, is this:

import EVM from 0xe467b9dd11fa00df
import FlowServiceAccount from 0xe467b9dd11fa00df

transaction(from: String, to: String, amount: UInt) {
    let flowServiceAccountAdmin: &FlowServiceAccount.Administrator

    prepare(signer: auth(BorrowValue) &Account) {
        self.flowServiceAccountAdmin = signer.storage.borrow<&FlowServiceAccount.Administrator>(
            from: /storage/flowServiceAdmin
        ) ?? panic("Unable to borrow reference to administrator resource")
    }

    execute {
        let txResult = self.flowServiceAccountAdmin.governanceDirectCall(
            from: from,
            to: to,
            amount: amount
        )

        assert(
            txResult.status == EVM.Status.successful,
            message: "evm_error=\(txResult.errorMessage);evm_error_code=\(txResult.errorCode)"
        )
	}
}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

And the flow cli command:

flow transactions send transactions/reclaim_EOA_tokens.cdc --network=mainnet-fork --signer=mainnet-fork-service "0x9D9247F5C3F3B78F7EE2C480B9CDaB91393Bf4D6" "0x00000000000000000000000235aE95896583818d" 2_030_023_297_036_000_000_000_000

Copy link
Member

@joshuahannan joshuahannan left a comment

Choose a reason for hiding this comment

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

Can you add a comment to the contract saying that it is temporary and will be removed immediately after the remediation is complete?


access(all)
fun governanceDirectCall(from: String, to: String, amount: UInt): EVM.Result {
return EVM.reclaimFundsFromAttackerEOAs(from: from, to: to, amount: amount)
Copy link
Member

Choose a reason for hiding this comment

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

reclaimFundsFromAttackerEOAs is access(account) (onflow/flow-go@dde3be6#diff-02837edc597afad5bd8f7d1962c129bded25adcc21a9889382c7aaad9a0e5b34R1035). Are the EVM contract and the FlowServiceAccount contract deployed to the same account?

Copy link
Member

Choose a reason for hiding this comment

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

yes, they are both deployed to the service account: https://www.flowview.app/account/0xe467b9dd11fa00df/contract

@m-Peter m-Peter force-pushed the mpeter/add-governance-direct-call branch from 9631f2c to a0ee978 Compare December 31, 2025 09:56
@m-Peter
Copy link
Collaborator Author

m-Peter commented Dec 31, 2025

Can you add a comment to the contract saying that it is temporary and will be removed immediately after the remediation is complete?

@joshuahannan Added the following comment: https://github.com/onflow/flow-core-contracts/pull/573/files#diff-9e8f0a44281b8c7ef9a6c3678b452264575deba3f18c0de447a26a9b652c7cf8R190-R191, as well as https://github.com/onflow/flow-go/pull/8280/files#diff-02837edc597afad5bd8f7d1962c129bded25adcc21a9889382c7aaad9a0e5b34R1031-R1034 on EVM contract (flow-go).

@m-Peter
Copy link
Collaborator Author

m-Peter commented Jan 7, 2026

Closing this as the reclamation has been concluded.

@m-Peter m-Peter closed this Jan 7, 2026
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