Skip to content

feat: Added new core libraries: map, casting, codec, map, operators#7

Open
Turupawn wants to merge 3 commits intomasterfrom
core-libs
Open

feat: Added new core libraries: map, casting, codec, map, operators#7
Turupawn wants to merge 3 commits intomasterfrom
core-libs

Conversation

@Turupawn
Copy link
Copy Markdown
Owner

I've been working writing a full ERC20 example and this PR is an effort to upstream the generic interfaces and touch base on my current progress.

Added the following libraries:

  • mapping: Generic and abstract Hasher and HashMapStorage implementations for creating a Hashmap
  • casting: Interfaces for upcast and downcasting, this is not implemented yet
  • codec: Encode/Decode reads and writes through Buffer and Cursor
  • operators: Will be used in the future for operator overloading

However I have the following questions that I will put in separate comments for making easier follow ups

@@ -0,0 +1,2 @@
// TODO: Why is this not needed?
//use codec::{ Cursor, Encode, Decode }
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Question 1:
Why is this not needed? I can call everything from the std ingot even with an empty file. So what should be defined on this file?

// fn downcast(self) -> Option<To> // Option is in core lib, which isn't visible in lsp (see grant's PR)
}

pub impl IntDowncast<u8> for u256 {
Copy link
Copy Markdown
Owner Author

@Turupawn Turupawn Apr 28, 2025

Choose a reason for hiding this comment

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

Question 2:
In this PR I didn't include any EVM, nor Solidy specific code. Should that be maintained in a separated repo? If so, should I also remove all u256 references from the core library?

If we add them to the main repo, should I create an evm and solidity folders/ingots?

@Turupawn
Copy link
Copy Markdown
Owner Author

Question 3:
I'm testing this the following way:

./fe check --core /PATH/TO/MY/core /PATH/TO/MY/core

Why do I have to put the path twice?

@Turupawn
Copy link
Copy Markdown
Owner Author

Question 4:
Currently, there is already an Option and Default definition in the master brach. Should I put them into the std ingot? Or should I lower my new libraries to the root?

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.

1 participant