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

fix(agent): correct EVM plugin activation condition #962

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

0xAsten
Copy link
Contributor

@0xAsten 0xAsten commented Dec 10, 2024

Relates to:

Bug fix for EVM plugin activation logic

Risks

Low

Background

What does this PR do?

Fixes a logic bug in the EVM plugin activation condition where it was incorrectly checking for wallet addresses that do NOT start with '0x'.

What kind of change is this?

Bug fixes

Documentation changes needed?

Testing

Where should a reviewer start?

Review the change in agent/src/index.ts where the EVM plugin activation condition is modified.

Detailed testing steps

Code change:

// Before
getSecret(character, "EVM_PRIVATE_KEY") ||
(getSecret(character, "WALLET_PUBLIC_KEY") &&
!getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
? evmPlugin
: null,

// After
getSecret(character, "EVM_PRIVATE_KEY") ||
(getSecret(character, "WALLET_PUBLIC_KEY") &&
getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
? evmPlugin
: null,

The EVM plugin should be activated when the wallet address starts with '0x'
@@ -392,7 +392,7 @@ export function createAgent(
: null,
getSecret(character, "EVM_PRIVATE_KEY") ||
(getSecret(character, "WALLET_PUBLIC_KEY") &&
!getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
getSecret(character, "WALLET_PUBLIC_KEY")?.startsWith("0x"))
Copy link
Collaborator

Choose a reason for hiding this comment

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

probably don't need the ?. since getSecret always returns a string

@odilitime odilitime merged commit 9d3ab4c into elizaOS:main Dec 10, 2024
1 check passed
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.

2 participants