-
Notifications
You must be signed in to change notification settings - Fork 14
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
Refactor stages #211
Merged
Merged
Refactor stages #211
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
961dc72
feat: add holoceneTime field
thinkAfCod 627e357
fix: decode tx input to Attributes.AttributesDeposited
thinkAfCod 13874b9
refactor: base types and exceptions
thinkAfCod df84faf
refactor: datasource interface
thinkAfCod aee3593
refactor: stages interface
thinkAfCod 22e0265
refactor: datasource implement
thinkAfCod ab7d361
refactor: stages implement
thinkAfCod f6710b2
refactor: pipeline declare
thinkAfCod 6c46598
refactor: Lru cache provider
thinkAfCod f2caba2
refactor: add some comments
thinkAfCod e1343e9
fix: retrieval and frame queue
thinkAfCod File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -369,22 +369,14 @@ public static AttributesDeposited decode(String txInput) { | |
if (input.length != 260) { | ||
throw new IllegalArgumentException("bedrock deposit tx input length is not 164 bytes"); | ||
} | ||
int offset = 4; | ||
BigInteger l1BlockNum = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
BigInteger l1BlockTime = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
BigInteger baseFee = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
String l1BlockHash = Numeric.toHexString(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
BigInteger seqNum = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
String batcherHash = Numeric.toHexString(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
BigInteger l1FeeOverhead = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
offset += 32; | ||
BigInteger l1FeeScalar = Numeric.toBigInt(Arrays.copyOfRange(input, offset, offset + 32)); | ||
BigInteger l1BlockNum = Numeric.toBigInt(Arrays.copyOfRange(input, 28, 36)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这个改动之前的代码好啊,全是magic number There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. bedrock的有效数据位很少,现在只读有效的数据位。 |
||
BigInteger l1BlockTime = Numeric.toBigInt(Arrays.copyOfRange(input, 60, 68)); | ||
BigInteger baseFee = Numeric.toBigInt(Arrays.copyOfRange(input, 92, 100)); | ||
String l1BlockHash = Numeric.toHexString(Arrays.copyOfRange(input, 100, 132)); | ||
BigInteger seqNum = Numeric.toBigInt(Arrays.copyOfRange(input, 156, 164)); | ||
String batcherHash = Numeric.toHexString(Arrays.copyOfRange(input, 176, 196)); | ||
BigInteger l1FeeOverhead = Numeric.toBigInt(Arrays.copyOfRange(input, 196, 228)); | ||
BigInteger l1FeeScalar = Numeric.toBigInt(Arrays.copyOfRange(input, 228, 260)); | ||
return new AttributesDeposited( | ||
l1BlockNum, | ||
l1BlockTime, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package io.optimism.utilities; | ||
|
||
import com.google.common.cache.Cache; | ||
import com.google.common.cache.CacheBuilder; | ||
|
||
public class LruCacheProvider { | ||
|
||
public static final long DEFAULT_CACHE_SIZE = 300L; | ||
|
||
public static <K, V> Cache<K, V> create(long size) { | ||
return CacheBuilder.newBuilder().maximumSize(size).build(); | ||
} | ||
|
||
public static <K, V> Cache<K, V> create() { | ||
return CacheBuilder.newBuilder().maximumSize(DEFAULT_CACHE_SIZE).build(); | ||
} | ||
} |
4 changes: 3 additions & 1 deletion
4
...n/java/io/optimism/rpc/Web3jProvider.java → ...timism/utilities/web3j/Web3jProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个是bug吧,应该放到单独的pr里面提交,需要立即发布版本的