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: land program addresses off-curve #11355

Merged

Conversation

jackcmay
Copy link
Contributor

@jackcmay jackcmay commented Aug 3, 2020

Problem

The derived program address may land on the ed25519 curve and have a signer.

Summary of Changes

The signature verifier only accepts public keys that are on the curve. To separate the space between keypairs and program addresses force all program address to be off the curve.

This PR also adds a new syscall so that programs can call create_program_address. This is necessary because the dependency used to validate off curve has dependencies that are not compatible with BPF programs.

This is a compliment PR to #11323

Fixes #

@jackcmay jackcmay force-pushed the program-address-off-curve-web3 branch from e05fc4c to 70716cb Compare August 3, 2020 23:24
@codecov
Copy link

codecov bot commented Aug 3, 2020

Codecov Report

Merging #11355 into master will decrease coverage by 6.6%.
The diff coverage is 90.3%.

@@            Coverage Diff             @@
##           master   #11355      +/-   ##
==========================================
- Coverage    81.9%    75.2%    -6.7%     
==========================================
  Files         320       29     -291     
  Lines       75012     1344   -73668     
  Branches        0      154     +154     
==========================================
- Hits        61449     1012   -60437     
+ Misses      13563      299   -13264     
- Partials        0       33      +33     

static async findProgramAddress(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): Promise<[PublicKey, number]> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mvines Looks like this is causing esdoc issues, is there a better way then making [Pubkey, number] as a new type?

Copy link
Member

Choose a reason for hiding this comment

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

I've run into similar limitations in the past, a new type got me past it :-/

@jackcmay jackcmay force-pushed the program-address-off-curve-web3 branch 2 times, most recently from f8646a7 to 345ed62 Compare August 5, 2020 18:05
@jackcmay jackcmay force-pushed the program-address-off-curve-web3 branch from 345ed62 to dbee74d Compare August 6, 2020 09:43
@jackcmay jackcmay merged commit 5c4b815 into solana-labs:master Aug 6, 2020
@jackcmay jackcmay deleted the program-address-off-curve-web3 branch August 6, 2020 14:10
mergify bot pushed a commit that referenced this pull request Aug 6, 2020
(cherry picked from commit 5c4b815)

# Conflicts:
#	web3.js/module.flow.js
#	web3.js/src/publickey.js
#	web3.js/test/publickey.test.js
mergify bot pushed a commit that referenced this pull request Aug 6, 2020
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