cesar
hizo push a tmp-sigantory en cesar/cdk
45d551146a Add more commands
84c5b6d57f Remove the shared Mint instance between tests
Since the SignatoryManager spawns a worker (with `tokio::spawn`) to execute the
Signatory (which implements the `Signatory` trait), a mpsc channel is used to
exchange messages.
In side Tokio tests, each test has its own Tokio runtime. When the first test
is done, since `instantiate` shares all the Mint instances, their Tokio runtime
is dropped, and the tokio::spawn's task gets killed, breaking the channel.
Since the SignatoryManager has no way to respawn, understandably so, since the
task runs in an infinite loop, receiving messages and spawning new tasks to
non-blocking. There are two choices: either create one Mint per test (which is
what this PR does) or compile a modified version of the SignatoryManager for
tests, which performs the calls to the Signatory trait in place instead of
converting it to a message and passing to the signatory Tokio task.
The first option is more straightforward and fixes other instances of the code
where `tokio::spawn` is used, such as subscriptions.
A third option could be explored, which would imply spawning a Tokio runtime in
another OS-level thread, creating the Mint in that context, and sharing it with
everything else; perhaps this should explored further if the idea is to test
Mint this way.
7fe6e2b418 Introduce a SignatoryManager service.
The SignatoryManager manager provides an API to interact with keysets, private
keys, and all key-related operations, offering segregation between the mint and
the most sensible part of the mind: the private keys.
Although the default signatory runs in memory, it is completely isolated from
the rest of the system and can only be communicated through the interface
offered by the signatory manager. Only messages can be sent from the mintd to
the Signatory trait through the Signatory Manager.
This pull request sets the foundation for eventually being able to run the
Signatory and all the key-related operations in a separate service, possibly in
a foreign service, to offload risks, as described in #476.
The Signatory manager is concurrent and deferred any mechanism needed to handle
concurrency to the Signatory trait.
0cd1d6a194 style: Clean up CHANGELOG.md formatting and consistency (#625)
f7d9a1b5db Drop the in-memory database (#613)
* Drop the in-memory database
Fixes #607
This PR drops the implementation of in-memory database traits.
They are useful for testing purposes since the tests should test our codebase
and assume the database works as expected (although a follow-up PR should write
a sanity test suite for all database trait implementors).
As complexity is worth with database requirements to simplify complexity and
add more robustness, for instance, with the following plans to add support for
transactions or buffered writes, it would become more complex and
time-consuming to support a correct database trait. This PR drops the
implementation and replaces it with a SQLite memory instance
* Remove OnceCell<Mint>
Without this change, a single Mint is shared for all tests, and the first tests
to run and shutdown makes the other databases (not-reachable, as dropping the
tokio engine would also drop the database instance).
There is no real reason, other than perhaps performance. The mint should
perhaps run in their own tokio engine and share channels as API interfaces, or
a new instance should be created in each tests
* Fixed bug with foreign keys
[1] https://gist.github.com/crodas/bad00997c63bd5ac58db3c5bd90747ed
* Show more debug on failure
* Remove old code
* Remove old references to WalletMemoryDatabase
hace 3 semanas